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
1answer
7 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
16 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
32 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 ...
3
votes
1answer
35 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
20 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 ...
0
votes
0answers
17 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 ...
0
votes
1answer
44 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
14 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
21 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 ...
2
votes
0answers
58 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
77 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 ...
1
vote
1answer
37 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
129 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
8 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 ...
1
vote
0answers
22 views

is ERC-20 unalterable? [duplicate]

Taking this ERC-20 Contract standar structure: https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/token/ERC20/ERC20.sol Its it unalterable by developer? Could I change the ...
0
votes
2answers
27 views

Can I use OpenZeppelincontract to create your own contract on testnet and mainnet?

I'm learning ERC-1155 Multi Token Standard, and I found great OpenZeppelin tutorial. However, I'm not sure if I can use that OpenZeppelin contract when I deploy my contract to the testnet or mainnet. /...
0
votes
0answers
13 views

Is an ERC721 Token an Instance of a Contract?

I'm new to smart contracts and I would like to get my head around the concept of "tokens". From what I understand tokens are defined by smart contracts. So one could say, "This token is ...
3
votes
1answer
145 views

deploying a simple ERC721 contract: transaction could not be decoded: could not recover secp256k1 key: calculated Rx is larger than curve P

You can check out the code here: https://github.com/lopeselio/Chainlink-VH-DynamicNFT Command: truffle migrate --reset --network rinkeby -f 3 Then response is as follows: Compiling your contracts... =...
1
vote
0answers
18 views

InternalCompilerError: Compiled contract not found. Contracts are correctly pointed to

Environment OpenZeppelin 2.5.1 Truffle v5.2.4 (core: 5.2.4) Node v15.11.0 Details Inheriting the PostDeliveryCrowdsale into my crowdsale contract fails to compile as can be seen below, this only ...
2
votes
2answers
174 views

why require() is checked after executing transfer()

From OpenZeppelin's ERC721 contract: function _safeTransfer(address from, address to, uint256 tokenId, bytes memory _data) internal virtual { _transfer(from, to, tokenId); require(...
0
votes
1answer
24 views

Override inherited function visability

I have a contract that looks like this: pragma solidity ^0.6.0; import "@openzeppelin/contracts/token/ERC20/ERC20.sol"; contract SwappableToken is ERC20 { constructor(string memory name, ...
1
vote
1answer
32 views

What are the under-the-hood mechanics for locking an ERC-20 token?

I have some idea of what "locking ether" means, but I need to understand for sure. AFAIK, tokens exist at some address, but according to many sources, the token is locked in a smart ...
0
votes
0answers
127 views

Transfer Failing in Solidity Smart Contract

I am calling the following function from a front-end on a Solidity smart contract, but it is not transferring the price and commission amounts properly with the call functions, although the ownership ...
1
vote
4answers
918 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; ...
0
votes
0answers
17 views

Creating upgradable child contract

I am creating a contract fabric program in which if a new user comes, i will deploy a child contract for that user. My parent contract is openzepplin upgradable contract. Checking whether i can ...
0
votes
1answer
41 views

How to get address of an upgradeable smart contract in another smart contract

I have the following two contracts contract MyNFT is ERC721Upgradeable, OwnableUpgradeable { function initialize() initializer public { __ERC721_init_unchained("My NFT", "MNF"...
0
votes
0answers
101 views

What is the difference between SafeERC20.sol VS ERC20.sol

Need to understand the safeERC20.sol and ERC20.sol from openzeppelin I was reading the medium articles and unable to understand why safeERC20.sol has been used Please help me understand this Thanks
0
votes
0answers
71 views

Implementing Roles using OpenZeppelin's AccessControl.sol

First time poster so please go easy! I'm new to Solidity. Have been programming about 2-3 years & I'm working on an Ethereum supply chain dapp for a college project. I've got to the point where I ...
0
votes
1answer
44 views

Initialize function is not invoked during deployment of upgradeable contract

This is initialize function of my upgradeable contract contract MyContract is Initializable, ERC20PresetMinterPauserUpgradeable, OwnableUpgradeable { function initialize(string ...
1
vote
1answer
113 views

registerInterface and parent constructors in Solidity

The openzeppelin ERC721.sol file contains the following code: constructor (string memory name, string memory symbol) public { _name = name; _symbol = symbol; _registerInterface(...
0
votes
1answer
51 views

Using openzeppelin-test-environment to test upgradeable contract

openzeppelin-test-environment is quite a new package, it doesn't tell how to initialize the upgradeable contract https://github.com/OpenZeppelin/openzeppelin-test-environment Just a basic example from ...
0
votes
1answer
47 views

Using openzeppelin Interfaces

If I import an openzeppelin Interface using @openzeppelin/contracts/token/ERC721/IERC721.sol, do I still need to declare the functions I wish to use found in the Interface, or the import statement is ...
0
votes
1answer
150 views

how to set tokenid in erc721 openzeppelin? [closed]

First of all, sorry if I'm asking an obvious question. In ERC721 openzeppelin API, to manage a token you always need to refer to a tokenId. Are you supposed to define a global variable, or a mapping ...
2
votes
1answer
55 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) ...
2
votes
2answers
569 views

Can't override ERC20 Methods

I try to override ERC20 methods ... The doc says it should be possible but I get the error: CompileError: @openzeppelin/contracts/token/ERC20/ERC20.sol:96:5: TypeError: Trying to override non-virtual ...
0
votes
1answer
103 views

Truffle build dont find _mint and _burn -DeclarationError: Undeclared identifier. Did you mean “mint”? _mint(to, amount);

after some trouble with remix I'm back at a npm/truffle/ganache setup... The reason why I tried out remix was: DeclarationError: Undeclared identifier. Did you mean "mint"? _mint(to, ...
0
votes
1answer
24 views

Why Transfer function doesn't check for allowance comparing to TransferFrom?

Why Transfer function doesn't check for allowance comparing to TransferFrom? Do I need to call increaseAllowance each time before calling TransferFrom? Ex implementation of Transfer without allowance ...
1
vote
1answer
24 views

OpenZeppelin balanceOf(address) function Vs Mapping

The OpenZeppelin ERC-721 library has a function called balanceOf(address owner), which enables one to know how many tokens an address owns. Furthermore, one can also use a mapping in order to keep ...
0
votes
0answers
27 views

How to use signed message and prevent replay attack when using openzeppelin ERC20 contract?

openzeppelin ERC20 provide building blocks to quickly build ERC20 smart contract. Here is an simple example: pragma solidity ^0.4.24; import "openzeppelin-solidity/contracts/token/ERC20/ERC20....
0
votes
1answer
19 views

can a developer delete balances trough a contract update using openzeppelin

I am new to this and just have some arbitrary questions regarding upgradeable smart contracts. If a Developer would update his contract, could he modify all mappings / variables entirely? Wipe ...
0
votes
1answer
137 views

Abstract contract not inheriting constructor from parent abstract contract

I'm using solidity 0.7.1 and I seem to be running into issues while inheriting from an abstract contract. Specifically with the open zeppelin library, now I'm not creating an issue there because their ...
0
votes
2answers
1k 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 ...
0
votes
0answers
192 views

ERC721 Token Transfer Outside Smart Contract

I am using OpenZeppelin ERC721 implementation for my non fungible tokens. Basically I have a smart contract which inherits from the OZ ERC721.sol. I am just wondering is the tokens only transferable ...
0
votes
1answer
288 views

npm install - - global @openzeppelin/cli not working

Guys I have node js and npm installed. But when I try to install OpenZeppelin sdk using the command: npm install --global @openzeppelin/cli It doesn't install. I don't know what is wrong. But I think ...
0
votes
1answer
20 views

Call method of another contract from one contract in upgradable smartcontract

I have two contracts Vase and Box contract Vase { uint256 public vase1; event VaseValueChanged(uint256 newValue); function createVase(uint256 newValue) public { vase1 = newValue; ...
0
votes
0answers
959 views

Gas estimation fail

I am using remix and ganache and metamask and I encounter a confusing error. I compiled and deployed USDT at 0xdac17f958d2ee523a2206206994597c13d831ec7 on ganache with no problem. In order to do ...
0
votes
1answer
176 views

Is it possible to put the initial ERC20 supply into a contract holding address that is not the token creators address?

With the standard open zeppelin ERC20 contracts, a fixed supply can be created by minting all of the new tokens to the contract creator. But this does not 'look good' and has the risk of the contract ...
4
votes
1answer
340 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 ...
0
votes
1answer
156 views

buyTokens throws error when is is getting called

Whenever I the buyTokens function is getting executed, I am getting below error Reason provided by the contract: "ERC20: transfer amount exceeds allowance". Debug the transaction to get more ...