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
0answers
2 views

How to access upgradeable contract using golang

Recently I'm writing some UUPS pattern proxy contract with upgradeable features. Due to some limitations of my works, I need to deploy both proxy and implementation contract in golang. However, ...
0
votes
0answers
11 views

ValueError: Gas estimation failed:

I followed this tutorial, https://www.youtube.com/watch?v=p36tXHX1JD8&t=1704s, and was able to get it up and running. I made a couple modifications and all seems well. I'm planning on deploying ...
0
votes
0answers
10 views

ERC-721 token metadata not displayed on NFT marketplaces when using IPFS

I have the following contract deployed to the Rinkeby testnet: https://rinkeby.etherscan.io/token/0x2d29fc6c1b20c35669fb55fa3144cdd529302256 I deployed the metadata and images using IPFS. When I try ...
2
votes
1answer
34 views

File outside of allowed directories on brownie compile command

trying to import to files from openzeppelin and chainlink in my contract file like so: import "@openzeppelin/contracts/token/ERC721/ERC721.sol"; import "@chainlink/contracts/src/v0.6/...
0
votes
0answers
8 views

Where to find SafeMath pragma solidity ^0.6.6?

While trying to use SafeMath to compute the modulo of a uint256 like shown in this video:https://www.youtube.com/watch?v=JqZWariqh5s (without SafeMath) I'm having some trouble finding a pragma ...
0
votes
2answers
29 views

Ownable in upgradeable contracts

I'm trying to get my head around the Ownable role in Upgradeable contracts in open zeppelin. It seems there have been a lot of updates recently and most tutorials and answers are therefore outdated. I'...
0
votes
0answers
8 views

SafeMath Utility Error in Ethereum Document 'Unique Digital Asset' Code

I refer to the example code 'Unique Digital Asset' code in Ethereum Doc (https://ethereum.org/en/developers/docs/smart-contracts/anatomy/#unique-digital-asset) line 60. uint256 id = SafeMath.sub(...
1
vote
2answers
32 views

How can one access values returned via "return(0, returndatasize())"?

I was looking at the _delegate function in OpenZeppelin's Proxy.sol: /** * @dev Delegates the current call to `implementation`. * * This function does not return to its internall call site, it will ...
0
votes
0answers
14 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.
0
votes
2answers
49 views

Slither Tool Error On Contract That Inherit From Openzeppeling

Hey Guys Hi ALl ! *I'm trying to use SLITHER (analizy tool ) but when i try to use it on a contract what inherit from Openzeppelin it give me this error(photo) Error: Source "@openzeppelin/...
1
vote
1answer
31 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 ...
0
votes
2answers
19 views

How to use Rinkeby to display web3 front end of smart contract other than localhost

Is there some functionality with Rinkeby to display my smart contract on something other than localhost so that other members of my team can access the frontend? Will I have to make my own server or ...
2
votes
1answer
31 views

Remix VM error when deploying

I'm trying to deploy this code. // contracts/GLDToken.sol // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "@openzeppelin/contracts/token/ERC777/ERC777.sol"; contract ...
0
votes
1answer
40 views

BalanceOf(address) method returning an Array of several values rather than a single one after a transfer

The Token challenge on Ethernaut - function returning Arrays in console - why? // SPDX-License-Identifier: MIT pragma solidity ^0.6.0; contract Token { mapping(address => uint) balances; uint ...
1
vote
1answer
38 views

How do Abstract classes help prevent reentrancy for multiple accounts?

I was reading through the openZeppelin contracts and saw the ReentrancyGuard contract, and realized I don't know how the EVM deals with these contracts. Assuming you have a class: contract someClass ...
0
votes
0answers
32 views

:38:14: ParserError: Expected '(' but got identifier, got this error when trying to compile this code, can someone help please,thank you

pragma solidity 0.6.6; import "@openzeppelin/contracts/token/ERC721/ERC721.sol"; import "@chainlink/contracts/src/v0.6/VRFConsumerBase.sol"; contract AdvancedCollectible is ...
0
votes
1answer
75 views

totalSupply() count issue

I'm writing an NFT minting contract with openZeppelin and have 2 functions that can mint tokens. mint and reserveMint. Each function can be invoked independent of each other in various order at ...
0
votes
0answers
49 views

TypeError: Type function (uint256) pure returns (string memory) is not implicitly convertible to expected type string memory

In Remix I'm getting this strange error while calling Strings.sol library: TypeError: Type function (uint256) pure returns (string memory) is not implicitly convertible to expected type string memory. ...
2
votes
2answers
147 views

How to use contracts from project dependencies in Brownie scripts?

I want to deploy a contract directly accessible in OpenZeppelin/openzeppelin-contracts@4.2.0 Brownie package without changes, namely ERC1967Proxy and other non-abstract contracts from Brownie console. ...
0
votes
0answers
44 views

Import Open Zepplin Contracts from Github

I'm trying to write a simple aggregator for aave, (I couldn't find a good example for one which uses aave V2) So I decided to cheat, and piece meal things together off of Polycats Github I noticied ...
0
votes
0answers
38 views

Try to setup an 1155 token to be render with all its metadata (name, description, image) to opensea.io

I have the smart contract below pragma solidity ^0.8.2; import "@openzeppelin/contracts/token/ERC1155/ERC1155.sol"; import "@openzeppelin/contracts/token/ERC1155/extensions/...
0
votes
2answers
190 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 ...
0
votes
1answer
61 views

@openzeppelin/contracts: Why can't I use a Gnosis Safe as the crowdsale wallet?

I have a crowdsale contract which inherits the following contracts from openzepplin: contract MyCrowdsale is Crowdsale, TimedCrowdsale, AllowanceCrowdsale, PostDeliveryCrowdsale, ...
0
votes
0answers
46 views

Reading private variable of mapping(address => uint256) using getStorageAt

I'm trying to access a private variable in my contract using getStorageAt(). OpenZepplin's PostDeliveryCrowdsale has the following (taken as-is): contract PostDeliveryCrowdsale is TimedCrowdsale { ...
0
votes
1answer
35 views

What does variable _allowances mean?

i was trying to understand this ERC20 Contract in OpenZeppelin. In 36th line there is a mapping which defines _allowances, it is being used in multiple lines (120, 155, 177, 196, 311) and i don't get ...
0
votes
1answer
13 views

Can I change the code in openzeppelin library in the node modules?

I am doing nft platform like opensea using openzeppelin. There are some limitations in openzeppelin like only the owner can send the token to anyone. I don't want to use approve function. If I comment ...
0
votes
1answer
14 views

wrapping state variables in struct

I asked this question in OZ forum and I'm asking it here again. The question is Why a state variable is wrapped in a struct in their Counters library. Please see the question in that post. Thanks.
0
votes
1answer
93 views

OpenZepplin simple crowdsale - can't buy tokens

I have a very simple OpenZepplin (v2.5.1) crowdsale contract deployed on Rinkeby Testnet. But when I try to buy tokens it fails with SafeERC20: low-level call failed Why? pragma solidity ^0.5.5; ...
1
vote
0answers
30 views

Transferring NFT Tokens without the ownership of the tokens but approving the contract address as operator

https://github.com/ProjectOpenSea/opensea-creatures/blob/master/contracts/ERC721Tradable.sol Someone please explain me the function at line 91
0
votes
0answers
26 views

Contract's admin keys/ownership relations

I have debated with myself about smart contract's admin keys and ownership and how this can occur in different ways. I will try to point some of the findings that I have found: OpenZepellin community ...
1
vote
1answer
15 views

Interacting with contract via remix

I am following the code from 721 sample https://docs.openzeppelin.com/contracts/4.x/erc721 using remix, it compiles and deploys correctly to test network, now my question is how to interact with the ...
0
votes
0answers
152 views

Get the error "ERC1155: caller not owner or approved" even after calling setApprovalForAll function

I have a question about the openzeppelin erc1155.sol contract. It is regarding operator approval and the safeTransferFrom() function. I am trying to do an ERC1155 token transfer and keep getting the ...
0
votes
1answer
255 views

Transfer only available for objects of type "address payable", not "address"

I am reading the book Mastering Blockchain Programming With Solidity by Jitendra Chittoda published by Packt Publishing. On page 129 it has a sample contract to deploy using the Remix IDE and MetaMask....
0
votes
0answers
51 views

What's the purpose of 'initializing' and 'initialized' in OpenZeppelin's Initializable contract?

The OpenZeppelin Initializable.sol contract includes a modifier initializer() that shows: modifier initializer() { require(initializing || isConstructor() || !initialized, "Contract instance ...
0
votes
1answer
27 views

How can I do an internal transfer using OpenZeppelin code?

I have a contract that holds all its tokens. Now I need to transfer tokens to an user that sends some BNB to its "receive" fallback. So... in OpenZeppelin derived contracts we have no access ...
0
votes
1answer
300 views

How exactly do I extend an openzeppelin contract (ERC721) with their extensions?

So I know that in the past there used to be an ERC721Full.sol inside the token directory of openzeppelin but now it seems that they have added an extensions folder that I just can't seem to understand....
0
votes
0answers
91 views

I had a error like : ParserError: Source file requires different compiler version , while using Chainlink&OpenZeppelin

I'm trying to implement PatrickAlpha NFT-mix implementation (Github link) . When I followed readme instructions, collectibles are minted correctly. But If I tried to change anything in the code , it ...
1
vote
0answers
63 views

Event name conflicts and data out-of-bounds error in Remix

I have been getting a weird errored: Error: data out-of-bounds (length=0, offset=32, code=BUFFER_OVERRUN, version=abi/5.1.2) error when testing contract functions in Remix, even though it goes through ...
4
votes
1answer
136 views

Why does OpenZeppelin implement increaseAllowance and decreaseAllowance functions differently in their ERC20 contract?

This is copied from their ERC20 contract from github (https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/token/ERC20/ERC20.sol): function increaseAllowance(address spender, ...
1
vote
0answers
63 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 ...
1
vote
0answers
50 views

Creating an openzeppelin-contracts-upgradeable Smart Contract

I have created a smart contract with the "standard" openzeppelin library for an ERC721 token (It has not been deployed yet). I would like to make my contract upgradeable. Can I simply ...
1
vote
1answer
189 views

What's the difference between OpenZeppelin's IERC vs ERC contracts?

I'm using the contracts OpenZeppelin provides, but I don't understand why there is 2 version of the same one. Why is there an I version vs non-I?
0
votes
1answer
30 views

What is the best way to transfer tokens to/from the internal balance using OpenZeppelin?

I'm using OpenZeppelin as base for my contracts. I know it don't allow me to access _balances directly, only using transfer(). But this function only allow transfer tokens from/to the sender, hidding ...
0
votes
0answers
65 views

How does the Open Zeppelin ERC721 preset work?

I'm using the ERC721 preset from Open Zeppelin. If I'm understanding the contract correctly, one of the main differences from the standard ERC721 is that the latter only has to be deployed once and ...
5
votes
1answer
254 views

Understanding OpenZeppelin's Context contract

I'm new to solidity and trying to understand OpenZeppelin's Context contract. At the time of writing, the documentation says: While these are generally available via msg.sender and msg.data, they ...
0
votes
0answers
137 views

Unable to verify Contract on BSC Scan

deployed a Contract. Wanted to verify the contract on BSC Scan but got the following error: Contract Adress is 0x709e26c4f1bb25d25b63a930e7cda6b3ed4a841b As I see, the ByteCode BSCScan is looking for ...
2
votes
1answer
107 views

How does ERC2309 implementation differ or change a standard ERC721

My understanding of the ERC721 minting process is that it follows three basic steps, it updates the owners balance (mapping _balances), it makes a record, associating the tokenId to the owners address ...
0
votes
0answers
15 views

OpenZeppelin guidelines on reverting

In the OpenZeppelin ERC20.sol contract you can find * We have followed general OpenZeppelin guidelines: functions revert instead * of returning `false` on failure. This behavior is nonetheless ...
1
vote
1answer
334 views

Why are there two functions with the same name in ERC721 OZ contract?

I'm looking at the OpenZeppelin ERC721 contract, and the function _safeMint is defined twice: /** * @dev Safely mints `tokenId` and transfers it to `to`. * * Requirements: d* ...
0
votes
0answers
27 views

Unable to grant role to self using AccessControl.sol

myContract implements OpenZeppelin's AccessControl. I want my account to grant MINTER_ROLE to the same account. The value of "account" is the same as the contract's creator. Why is the code ...