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.
105
questions
0
votes
3answers
38 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
14 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
15 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
20 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
16 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
15 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
20 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
17 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
19 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
37 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
31 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
109 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
23 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
16 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
19 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
17 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
17 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
40 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
246 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
80 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
159 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
16 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
225 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
66 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 ...
3
votes
1answer
96 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
80 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 ...
1
vote
1answer
45 views
Node version upgrade for contract deployment throws error
I wrote a solidity contract using version 0.4.24 using OpenZeppline-solidity version 1.12.0. This used to deploy using the Nodejs version 8.12. The Nodejs version 8 is no longer being maintained from ...
1
vote
1answer
652 views
How to implement “Mint” and “Own” in an ERC20 Token
So, I recently created a standard ERC20 token but I need to implement "mint" and "owner" functionality. I see that in older implementations but openzeppelin no longer has contracts ...
0
votes
0answers
47 views
Ether Transaction failed to crowdsale contract
I have deployed a token on ropsten. it works and i can transfer tokens. Now i deployed crowdsale contract but when i send ether to crowdsale contract the transaction fails.
I am using remix and ...
0
votes
1answer
129 views
My contract is deployed but instance is undefined
I have deployed a contract on the ganache blockchain successfully using truffle.
In the truffle console, I can call the contract fine
truffle(development)> MyCoin
[Function: TruffleContract] {
...
2
votes
1answer
84 views
Visual Studio Code's Solidity extension shows unecessary warnings/errors
I am using Juan Blanco's Solidity extension for VSC. I am noticing it is showing just too many warnings everywhere, including the OpenZeppelin contracts in the node_modules folder. Is there any ...
0
votes
1answer
34 views
OpenZeppelin default FixedSupply contract not sending balance to sender
I'm deploying a very standard openzeppelin ERC20 contract with the following code:
pragma solidity ^0.6.0;
import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
contract ERC20FixedSupply is ERC20 ...
2
votes
1answer
33 views
Why doesn't CryproKitties contract use Enumerable.sol?
I am going through the Cryptokitties code, which does not include the optional Enumerable contract, but the KittyBase contract basically declares equivalent indexation and functions. Why did ...
0
votes
1answer
50 views
How to structure a contract for future upgrades
Imagine I have a contract I have implemented and deployed like this:
pragma solidity ^0.6.0;
import "@openzeppelin/contracts/token/ERC721/ERC721.sol";
import "@openzeppelin/contracts/utils/Counters....
0
votes
1answer
38 views
Does a symbol have to be unique in ERC721? How to find out a unique symbol?
As per the ERC-721 contract on OpenZeppelin, you can create a token with this constructor:
constructor(string _name, string _symbol) public {}
Does the "_symbol" have to be unique across the ...
1
vote
1answer
134 views
Dynamic Delegate Proxy contract
I'm familiar with proxy contracts in solidity using the 'delegatecall' to separate out the proxy contract from the logic contract. Is there a simple way to choose the logic contract based on an ...
1
vote
1answer
104 views
ERC-20 Token Smart Contract Redeployment
Hello everyone am wondering how can someone redeploy ERC-20 Token Smart contract thats already deployed?
I have already deployed few contracts both on Ropsten Test Network and on Main ETH Network ...
3
votes
1answer
508 views
TypeError: Derived contract must override function ā_beforeTokenTransferā
I am trying to implement an ERC20 token that inherits ERC20.sol, ERC20Detailed.sol, ERC20Burnable.sol, ERC20Mintable.sol, and ERC20Pausable.sol.
contract DemoContract is ERC20,ERC20Detailed,...
0
votes
0answers
47 views
Token transfer lock after crowdsale
I am faced with a problem regarding the ICO and Token smart contracts (SCs). I am currently using OpenZeppelin SCs to create my token and ICO and everything is working fine. Now I would like to add a ...
0
votes
2answers
354 views
Super simple token with Open Zeppelin
I want to create a super simple token for my community. I read some tutorials and I found this code:
pragma solidity ^0.5.2;
import "./lib/oz/contracts/token/ERC20/ERC20Pausable.sol";
import "./lib/...
1
vote
2answers
638 views
Sign message with web3 and verify with openzeppelin-solidity ECDSA.sol
I'm trying to get a little example working with ECDSA.sol here: https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/cryptography/ECDSA.sol
This contract:
Generate a random(...
1
vote
2answers
127 views
ERC20 not recognized by TokenTracker
I have deployed ERC20 with reference to
// File: openzeppelin- zos/contracts/token/ERC20/DetailedMintableToken.sol
I called the initialized function with owner, name, symbol and decimal value. ...
0
votes
1answer
77 views
ERC20Mintable contract call return wrong number
I use OpenZeppilin ERC20Mintable contract and add MaxSupply parameter to contraint the ERC20 token amount allowed to issue.
what I want is only permit contract ower to view MaxSupply info, my ...
1
vote
1answer
184 views
How to initialize inherited contract
I find there is a contract named ERC20Capped inherited from ERC20Mintable in zippelin contract project.
Both of them have their own construction parameters.How to assign value to them during contract ...
1
vote
1answer
655 views
can etherscan.io show local ganache transaction details?
I am purchasing tokens on my sample Dapp with ganache-cli account using metamask.
Metamask shows the confirm message and deduct the ether from total balance but in token section it still not update ...
0
votes
2answers
3k views
File import callback not supported import “./IERC20.sol”;
when I try to compile my contract I see errors like this :
DemirelToken.sol
https://eksiup.com/p/4z49413damc3
here's the code :
pragma solidity ^0.5.0;
import "node_modules/openzeppelin-...
0
votes
2answers
231 views
ERC721 exchange logic
I'm trying to allow NFT holders to sell their tokens by listing prices (ETH) and allow others to buy those listed tokens.
I used openzeppelin and succesfully implemented and tested my token creation. ...
0
votes
1answer
205 views
How to use function modifier to control contract function access right?
I deployed a ERC20Mintable token in truffle environment(the source file is ERC20Mintable.sol).
The mint function is declared with onlyMinter modifer:
contract ERC20Mintable is ERC20, MinterRole {
...
1
vote
1answer
105 views
ERC721 Metadata and Items
i'm new to ERC721 tokens so this may be a stupid question.
Following the Opensea docs and other docs (for example openzeppelin ones), I just create a simple ERC721 token that i called "avatar" which ...
1
vote
1answer
104 views
Error installing zos-lib@2.4.0
I am working through the tutorial for zeppelin-os found here: https://docs.zeppelinos.org/docs/linking.html
and have an error when running zos create
Could not find file zos-lib/contracts/...