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
1k 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
2answers
188 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 ...
1
vote
0answers
167 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
1k 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,...
1
vote
0answers
20 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
254 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 ...
1
vote
0answers
96 views

How to get back the ownership from crowdsale?

When I started crowdsale, I transferred token ownership to the crowdsale contract. When the sale finished, I'd like to send back the ownership to token so that the next crowdsale will start. How can I ...
1
vote
2answers
455 views

Escrow account creation in the example ICO contract from openzeppelin

I am understanding the ICO as explained in openzeppelin https://github.com/OpenZeppelin/openzeppelin-solidity/tree/master/contracts/examples When I called the "Buy tokens" the beneficiary is getting ...
1
vote
0answers
1k views

Issue in installing truffle-hdwallet-provider

I am trying to install "truffle-hdwallet-provider" using the command "npm i truffle-hdwallet-provider --save". I am getting the beow mentioned error. Please assist me in resolving this. truffle-...
1
vote
1answer
122 views

Not able to deploy crowdsale

when i am doing truffle migrate.i am able to deploy my crowdsale contract but my token contract is getting deployed but not the crowdsale contract. var Sportist = artifacts.require("./Sportist.sol"); ...
1
vote
1answer
2k 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="...
0
votes
1answer
179 views

OpenZepplin simple crowdsale - can't buy tokens

I have a very simple OpenZepplin (v2.5.1) crowdsale contract deployed on Rinkeby Testnet. But when I try to buy tokens it fails with SafeERC20: low-level call failed Why? pragma solidity ^0.5.5; ...
0
votes
2answers
37 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
1answer
263 views

ERROR: Contract should be marked as abstract [duplicate]

Hi I am following a tutorial on Chainlink NFTs but I get this error below which reads: Contract should be marked as abstract. Now I see this same question was asked before however in that person's ...
0
votes
2answers
506 views

Ownable in upgradeable contracts

I'm trying to get my head around the Ownable role in Upgradeable contracts in open zeppelin. It seems there have been a lot of updates recently and most tutorials and answers are therefore outdated. I'...
0
votes
2answers
1k views

Error HH411: The library openzeppelin-solidity is not installed. Try installing it using npm (for old 0.5.0 solidity code)

I have solidity project with files like pragma solidity ^0.5.0; import "openzeppelin-solidity/contracts/ownership/Ownable.sol"; When I try to compile, I get error on not installed library ...
0
votes
1answer
1k 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
1answer
1k 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
139 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() { ...
0
votes
1answer
18 views

EIP-2771: Is it possible to pay a function with from's eth, not the forwarder contract's eth

I use OpenZeppelin ERC-2771 lib. I managed to forward an EIP-712 signed transaction to a contract. The function I call is payable. So far I only managed to have my Forwarder contract paying the ...
0
votes
1answer
42 views

ERC20 Decimals In Transfer

I got it why we need decimals in ERC20s. But the thing I can't get it: When we are using transfer() method, should we write amount in wei (for ERC20s decimals count) or just integere. For example: If ...
0
votes
2answers
409 views

Slither Tool Error On Contract That Inherit From Openzeppeling

Hey Guys Hi ALl ! *I'm trying to use SLITHER (analizy tool ) but when i try to use it on a contract what inherit from Openzeppelin it give me this error(photo) Error: Source "@openzeppelin/...
0
votes
1answer
211 views

totalSupply() count issue

I'm writing an NFT minting contract with openZeppelin and have 2 functions that can mint tokens. mint and reserveMint. Each function can be invoked independent of each other in various order at ...
0
votes
1answer
18 views

wrapping state variables in struct

I asked this question in OZ forum and I'm asking it here again. The question is Why a state variable is wrapped in a struct in their Counters library. Please see the question in that post. Thanks.
0
votes
1answer
146 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
400 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 ...
0
votes
1answer
367 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
66 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 ...
0
votes
1answer
27 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
34 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
1answer
358 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 ...
0
votes
1answer
299 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 ...
0
votes
1answer
108 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 ...
0
votes
2answers
556 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
1answer
374 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 { ...
0
votes
1answer
202 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 ...
0
votes
1answer
339 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 ...
0
votes
1answer
101 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 ...
0
votes
2answers
399 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 ...
0
votes
1answer
1k views

Calling the burn function

I am using the openzeppelin library and importing the StandardBurnableToken.sol logic into MyContract.sol here is a code pragma solidity ^0.4.17; import "/openzeppelin-solidity/contracts/token/...
0
votes
1answer
706 views

Altering / overriding the method from main contract

I am using openzeppelin to create a ICO as a CappedCrowdsale and TimedCrowdsale as mentioned in the example mentioned in the below link. Reference : https://github.com/buddies2705/Solidity-Tutorial/...
0
votes
1answer
167 views

Not able to deploy contract in testnet(Ropseten)

I am trying to deploy a crowdsale contract which is build upon openzeppelin while deploying it on geth --dev and ganache it gets deployed perfectly but whenever I am trying to deploy the contract on ...
0
votes
1answer
10 views

Ownable function call from another function

I have two ownable functions (I'm using openzeppelin), when I invoke the second function from the first one, I get: "Ownable: caller is not the owner". function first() external view ...
0
votes
0answers
8 views

Why removing royalty info on burn in Openzeppeling ERC721 Royalties extension?

In https://github.com/OpenZeppelin/openzeppelin-contracts/blob/783ac759a902a7b4a218c2d026a77e6a26b6c42d/contracts/token/ERC721/extensions/ERC721Royalty.sol#L34 we have function _burn(uint256 tokenId) ...
0
votes
0answers
17 views

Does anyone know how to use TimeLockController.sol from openzeppelin

I want to use the openzeppelin timelock controller contract in a way that it calls the functions of other deployed contracts at some time. The thing can be done with the openzeppelin timelock ...
0
votes
0answers
16 views

Understanding ERC721._checkOnERC721Received in openzeppelin library

When you use OpenZeppelin's ERC721 implementation, in most cases you call _safeMint function. _safeMint does some obvious basic operations except this one: require( _checkOnERC721Received(address(...
0
votes
0answers
78 views

"Contract might not be implemented correctly" but I'm using ERC721URIStorage from OpenZeppelin?

I'm trying out the OpenSea SDK using the following code: const expirationTime = Math.round(Date.now() / 1000 + 60 * 60 * 24) const assetPromise = seaport.api.getAsset({ tokenAddress : '...
0
votes
0answers
22 views

i am getting file not found error while compiling my file desipte importing files correctly

brownie compile INFO: Could not find files for the given pattern(s). Brownie v1.16.4 - Python development framework for Ethereum New compatible solc version available: 0.8.10 Compiling contracts... ...
0
votes
1answer
66 views

Should I use totalSupply() or a custom counter for ERC-721 token id?

I'm following OpenZeppelin ERC721 guide. They use a counter (Counters.Counter) for the tokenId. My contract inherits from ERC721Enumerable so I have totalSupply() out of the box. I was wondering if I ...
0
votes
1answer
266 views

Metadata not showing up for ERC-721 OpenSea NFT

I made NFT's, following this tutorial I deployed the smart contract via Remix to my Metamask on the Rinkeby Testnet. OpenSea detected the assets in my wallet after they were minted, but the pictures ...