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
1
vote
1answer
29 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
23 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
30 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
25 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
11 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
26 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
18 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 ...
0
votes
1answer
36 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
34 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
165 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
26 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
21 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
231 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
305 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
88 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
68 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
103 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
330 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
108 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
146 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
67 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
88 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
437 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
58 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
530 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
144 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
237 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
219 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
356 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
58 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
44 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
79 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
191 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
301 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
103 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
91 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
66 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
566 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
314 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/...
0
votes
1answer
92 views

Minted Crowdsale vs Non Minted Crowdsale

I am exploring openzeppelinr-solidity smart contracts for Initial Coin Offering(ICO). There are two options available for a token smart contract one is to have hardcoded total supply tokens or mint a ...
1
vote
1answer
554 views

How to Issue /Mint / Generate additional tokens? Contract is mintable

I have Token on ropsten network (https://ropsten.etherscan.io/token/0x975FB1824F82E446DD3F5c4cb04474468ED7d878) which is Mintable with initial supply of 10B and Mintable Cap up to 50B. My ether ...
2
votes
1answer
71 views

How to burn non burnable ERC20?

Suppose you received 250 HELLOCoins and you want to burn them. Unfortunately, HELLOCoins uses OpenZeppelin ERC20 which implements the following function: function _transfer(address from, address to,...
1
vote
1answer
353 views

Importing in SOLC to deploy smart contract

I don't run an Ethereum framework like Truffle and I want to deploy a smart contract using infura node. The smart contract is very simple: pragma solidity ^0.5.2; import "http://github.com/...
0
votes
1answer
52 views

What does the single line “_;” in OpenZeppelin's onlyMinter() function do? [duplicate]

In onlyMinter(), there is a line with only _;. I'm having troubles adding a minter address, so I'm just checking the various contracts that go into ERC721. The function is modifier onlyMinter() { ...
1
vote
0answers
92 views

No events were emitted - Exchanging ERC721 Tokens

Function to exchange ERC721 Tokens between two addresses. I am implementing this on truffle and openzeppelin 2.10. Two different tokens should be exchanged between two addresses. Here's my contract ...
1
vote
1answer
358 views

How to ERC721 token using external contract to msg.sender?

I have Caller and ERC721 contract just like this : contract SampleToken is ERC721MetadataMintable { string private name; string private symbol; constructor (address _creator, string _name,...
0
votes
0answers
174 views

Struct Mapping: DeclarationError: Identifier not found or not unique for

Using openzepplin version 2.0.0 and solc version 0.5. I am writing an ERC721 token contract on truffle. Truffle compiles with no error on solc 0.4.23. I had to upgrade to 0.5 due to openzepplin ...
1
vote
2answers
443 views

OpenZeppelin Starting Balance

I believe that the openzeppelin project have updated their StandardToken smart contract which is now called ERC20.sol. One issue that I have is that the new smart contract has some missing ...