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
2answers
56 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
13 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
33 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
50 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
36 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 ...
2
votes
1answer
28 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
33 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
37 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
188 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
29 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
54 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
45 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
24 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
29 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
30 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
21 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
61 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
49 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
305 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
34 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
0answers
22 views

zeppelin tutorial smart contract (noob alert) can't connect to network

I am following this tutorial - https://docs.openzeppelin.com/learn/deploying-and-interacting#local-blockchain Everything was going good until i was asked to type the command - $npx oz accounts - ...
0
votes
2answers
285 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/...
0
votes
2answers
416 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
107 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
73 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
134 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
449 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
2k 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
148 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
173 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
82 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
97 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/...
2
votes
2answers
494 views

What's the difference between Truffle Migrations and ZeppelinOS upgradeable contracts?

It was my understanding that Truffle migrations will move updated contracts to new addresses. As a developer, you can use this feature to update already deployed contracts with new code. ZeppelinOS ...
1
vote
1answer
61 views

how can I use takeOwnership function?

currently, I'm using openzeppelin. I can't find takeOwnership function in lately ERC721 interface. takeOwnership function deprecated? (I cant' find any document) so, how can I do that like ...
2
votes
2answers
1k views

low-level call failed

I'm using the crowdsale contract (https://github.com/OpenZeppelin/openzeppelin-solidity/blob/master/contracts/crowdsale/Crowdsale.sol). I have deployed a detailedERC20 smart contract. When I send the ...
1
vote
1answer
186 views

Transfer erc721 token to another address

I'm currently using transferFrom / safeTransferFrom to transfer the token to another address but I encounter this error. Error: Error: invalid address (arg="to", coderType="address", value="...
3
votes
2answers
292 views

How to test events that were sent by inner transaction / delegate call?

Usually, using truffle I can check for events like this: let { logs } = await myContract.doSomethingImportant( xxx ); // 1500 tokens are expected to get expectEvent.inLogs(logs, '...
4
votes
1answer
360 views

Compilation error using SafeMath

I am trying to do subtraction operation using the SafeMath library. The following is my code: pragma solidity ^0.5.1; library SafeMath { function sub(uint256 a, uint256 b) internal pure returns (...
1
vote
1answer
385 views

Updating ERC20 Contract from 0.4.0 to 0.6.0

Im updating some ERC20 contact code from solidity 0.4.0 to 0.6.0 and hitting some snags as it seems openzeppeling has changed its structure since then as can be expected. I cant access the balances ...
1
vote
1answer
92 views

ERC20 finishMinting() after ICO

When ICO is finalized, I call finishMinting() to prevent from adding new tokens to totalSupply. contract MyTokenCrowdsale is Crowdsale, MintedCrowdsale, CappedCrowdsale, TimedCrowdsale, ...
1
vote
1answer
47 views

ERC20 RefundableCrowdsale

I have a crowdsale contract that inherits RefundableCrowdsale.sol from OpenZeppelin. I was using their v1.10.0 initially, but now revamping it using v1.12.0. contract TestTokenCrowdsale is Crowdsale,...
1
vote
1answer
85 views

ERC721Token super._mint calls addTokenTo from the top level implementation

Based on Shawn's answer, super._mint calls addTokenTo from the top level implementation (ERC721Token). How does this work? super._mint calls _mint from ERC721BasicToken reads line addTokenTo ...
1
vote
1answer
240 views

ERC721 how does tokenOfOwnerByIndex() list tokens owned by a user?

Per eip-721, there's an optional "enumeration extension". So what I did was I called balanceOf to get the number of tokens owned by the account and called tokenOfOwnerByIndex in a loop to get each ...
2
votes
1answer
358 views

openzeppelin,VM Exception while processing transaction: revert

using openzeppelin-solidity to create crowdsale. Then I use this statement to Buy Token: MyCrowdsaleInstance.sendTransaction({ from: purchaser[1], value: web3.utils.toWei("0.5", "ether"), ...
1
vote
1answer
114 views

ParserError: Expected token Semicolon

I got this particular Parser error and can you help me how to fix this issue:while using this code pragma solidity ^0.4.17; import "../node_modules/zeppelin-solidity/contracts/token/ERC20/...
1
vote
2answers
99 views

OpenZeppelin contract not working on Kovan testnet

I created a simple smart contract using OpenZeppelin and deployed the contract to the Kovan testnet. However, when I send KEth to the contract using MetaMask, nothing happens (I believe the buyTokens ...
0
votes
1answer
78 views

DeclarationError: Identifier not found or not unique and Undeclared identifier

I am trying to create a crowdsale contract using zeppelin. But i am facing following errors. CrowdSale.sol:6:46: DeclarationError: Identifier not found or not unique. contract EdCoinCrowdSale is ...
1
vote
1answer
705 views

Solidity 0.5.2 - OpenZeppelin - New SafeERC20 callOptionalReturn(token,data)

i've been trying to mix ERC20 functionality with ERC223 function overloading technique and create a bridge for backwards compatibility using SafeERC20. For relevancy sake i renamed SafeERC20 into ...
0
votes
1answer
411 views

How to use 2 different constructors with open-zeppelin

I don't understand well how to implement an smart contract to create a capped Token. If I want to follow the example of a simple token is easy: https://github.com/OpenZeppelin/openzeppelin-solidity/...