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

How does EIP-2891 handle royalties?

I want to add secondary royalties to my smart contract for OpenSea and Rarible and also have royalties for the artist after every mint. I've been reading up on royalties implementations, specifically ...
1
vote
1answer
30 views

Can I send ETH to an Smart Contract address?

I'm developing an Smart Contract based in the Openzeppelin's Crowdsale one. When I test the Crowdsale Smart Contract manually, sending ETH with metamask, the SC returns me the correct amount of tokens....
1
vote
1answer
11 views

Counters.Counter vs totalSupply

Creating my first contract and was taking a look at the Open Zeppelin wizard. I notice that it includes a Counters.Counter private _tokenIdCounter;, which tracks the amount of tokens minted. When I ...
1
vote
0answers
94 views

Best practice to call onlyOwner function from remote system

About I am having an ERC721 contract (implementation). I want to run a script on a remote system (e.g. a docker container hosted in the cloud) that calls a function which writes to the contract and ...
0
votes
1answer
16 views

How Contract Method Works in Changing State Variable?

So, I'm trying to implement openzeppelin ERC721Enumerable contract. I want to override _beforeTokenTransfer method. Because it was a Hook, I have to call super method like this function ...
0
votes
1answer
21 views

Error: DeclarationError: Undeclared identifier while using IERC20

Code: pragma solidity ^0.6.2; import "@opengsn/gsn/contracts/BaseRelayRecipient.sol"; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; contract MyContract is ...
1
vote
1answer
27 views

OpenZeppelin Context.sol smart contract is abstract, why?

I was digging into this OZ smart contract: https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/utils/Context.sol As you may see, it has only two functions to deal with metatxs....
0
votes
1answer
21 views

It is safe to use OpenZeppelin v2.5 contracts (Solidity 0.5.0) in 2021?

I was checking some pretty old contract samples of OpenZeppelin v2.5, and they are in Solidity 0.5.0, and I am not sure if it is a safe version, or not. If I extend these types of contracts, it makes ...
0
votes
0answers
15 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
1answer
108 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
102 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
14 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
98 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
11 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
35 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
1answer
139 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
103 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
36 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
22 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
35 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
41 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
44 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
34 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
114 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
103 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
272 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
55 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
105 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
357 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
82 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
84 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
39 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
14 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
103 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
58 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
29 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
237 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
444 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
77 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 ...
1
vote
2answers
37 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
495 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
117 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
85 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
167 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
68 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
56 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
248 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
34 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 ...