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
47 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
59 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
42 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
36 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
49 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
132 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
633 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
35 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
76 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
40 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
50 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
301 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
44 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
120 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
69 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
108 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, '...
3
votes
1answer
89 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
125 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
38 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
29 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
58 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
90 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 ...
1
vote
1answer
166 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
67 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
75 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
39 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
405 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
185 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
55 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
349 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 ...
0
votes
0answers
60 views

Underflow attack, is it possible here?

Assume that you send X ERC20 SomeCoins and in exchange, you receive X/2 MyCoins. Both ERC20 have 4 decimals. My question is, if the user sends the minimum value or, a value that can't be divided by 2,...
1
vote
1answer
39 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
244 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
35 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
75 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
239 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
113 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
326 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 ...
3
votes
2answers
214 views

OpenZeppelin crowdsale token ownership

Using the non-modified OpenZeppelin code to create a mintable and burnable ERC20 token and a crowdsale contract, once ownership of the token is transferred to the crowdsale contract, is it possible to ...
1
vote
2answers
43 views

Make a crowdsale reusable?

I have a pretty standard OpenZeppelin crowdsale. Now the issue is that I want to be able to use one crowdsale contract with multiple (~100) different ERC20 tokens. Ideally I want to put the ...
1
vote
1answer
791 views

Truffle compile gives Parser Error: Error parsing openzeppelin-solidity/contracts/ownership/Ownable.sol

I installed the latest version of truffle, solc, node and also installed new version of openzeppelin-solidity library in my project. Changed the truffle-config.js to use new solc version. My contract ...
1
vote
1answer
135 views

Issue in comparing token contract address and address(0) in Solidity 0.5.0

I am trying to compare the token contract address with the address(0). This was working fine in older version of truffle and solidity compiler (0.4.24). When I upgraded truffle and started using the ...
3
votes
0answers
188 views

Questions on MinterRole contract in openzeppelin

I am using the openzeppelin for creating the ICO contract. I am concerned about the MinterRole here. After I develop Token contract, I added the sale contract as a minter using "addMinter" function. ...
1
vote
0answers
9 views

IncreasingPriceCrowdsale breaking TimedCrowdsale

For reasons I can't figure out why open-zeppelin's IncreasingPriceCrowdsale and TimedCrowdsale seem to be conflicting with each other. Here is a basic version of the Crowdsale contract I'm working ...
1
vote
1answer
45 views

Set rate for crowdsale after it has ended

The problem I am trying to solve is how to properly price an ICO. One idea would be to have 10 tokens available. Do the ICO and collect all the ETH. Then after the ICO has ended, divvy up the tokens ...
0
votes
1answer
47 views

How to automatically deliver the tokens in a PostDeliveryCrowdsale

My goal is to deliver the tokens only at the end of the crowd sale. I have seen the below code which can deliver the tokens in a batch. Questions Will this work even when there is a million _to ...
1
vote
1answer
104 views

Running Openzepplin from docker

I am trying to build a docker image using open zepplin libraries. It works until it has to import the zepellin library, for which it can't seem to find. Here is what my docker image looks like : ...
0
votes
2answers
75 views

(Truffle) how to call finalize() function after finishing crowdsale

I would like to call token.transferOwnership(msg.sender) after finishing timed crowdsale. So, I inherited FinalizableCrowdsale contract, then override finalization() function to call transferOwnership ...
2
votes
1answer
91 views

Issue in understanding MintedCrowdsale in the ICO contract from openzeppelin

I am trying to understand the openzeppelin code for writing ICO contract. In MintedCrowdsale, mint() function in ERC20Mintable is called as mentioned below. ERC20Mintable(address(token())).mint(...
1
vote
1answer
123 views

In OpenZeppelin _deliverTokens() from CrowdSale contract is not called

I am using openZeppelin for creating the ICO contract. Could you please help me to understand the below behaviour ? Crowdsale The CrowdSale contract is having the function buyTokens(). It calls the ...