# ERC721 Cost is giving error

**URL:** <https://forum.openzeppelin.com/t/erc721-cost-is-giving-error/21235>\
**Category:** Contracts\
**Tags:** erc721, etherscan-verify\
**Created:** [December 19, 2021, 6:02pm UTC](https://forum.openzeppelin.com/t/erc721-cost-is-giving-error/21235 "2021-12-19T18:02:07Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![nomanhaq](https://avatars.discourse-cdn.com/v4/letter/n/a88e57/32.png) [@nomanhaq](https://forum.openzeppelin.com/u/nomanhaq)\
**Post date:** [December 19, 2021, 6:02pm UTC](https://forum.openzeppelin.com/t/erc721-cost-is-giving-error/21235/1 "2021-12-19T18:02:08Z")

</div>

Hello everyone,  
I am having an issue with my deployed contract on Rinkeby testnet, when set cost more then zero it is giving me error while minting, my contract address is as bellow:

[https://rinkeby.etherscan.io/address/0x070eb9B8E83A1866F1b7a1D58C6b984C7Bff53a9#code](https://rinkeby.etherscan.io/address/0x070eb9B8E83A1866F1b7a1D58C6b984C7Bff53a9#code)

When i set cost as:  
uint256 public cost = 0 ether;  
It is perfectly fine and there is error coming, as soon as i set something like:  
uint256 public cost = 0.1 ether;  
It start showing me error, can anyone help me where thing goes wrong in the code.

Thanks in advance  
NomanHaq

#### 🔢 Code to reproduce

```auto

```

#### 💻 Environment

---

<div class="post-metadata">

**Author:** ![asmel](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.openzeppelin.com/asmel/32/11994_2.png) [@asmel](https://forum.openzeppelin.com/u/asmel)\
**Post date:** [December 19, 2021, 7:08pm UTC](https://forum.openzeppelin.com/t/erc721-cost-is-giving-error/21235/2 "2021-12-19T19:08:55Z")

</div>

can you show the error?

---

<div class="post-metadata">

**Author:** ![asmel](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.openzeppelin.com/asmel/32/11994_2.png) [@asmel](https://forum.openzeppelin.com/u/asmel)\
**Post date:** [December 19, 2021, 7:36pm UTC](https://forum.openzeppelin.com/t/erc721-cost-is-giving-error/21235/3 "2021-12-19T19:36:52Z")

</div>

the error you may notice is that if you try to update the cost value passing 0.1dara error, because you have to enter the value in wei to update from 0 to 0.1 you have to pass the value in wei that will be 0.1 ether = 100000000000000000 wei

It is also a good practice to make the required return an abvertion, to know where the errors are.

---

<div class="post-metadata">

**Author:** ![nomanhaq](https://avatars.discourse-cdn.com/v4/letter/n/a88e57/32.png) [@nomanhaq](https://forum.openzeppelin.com/u/nomanhaq)\
**Post date:** [December 20, 2021, 11:25am UTC](https://forum.openzeppelin.com/t/erc721-cost-is-giving-error/21235/4 "2021-12-20T11:25:32Z")

</div>

> [@asmel](#):
>
> 100000000000000000

Hello dear,

I did the same like:

```
uint256 public cost = 100000000000000000 ether;

```

and it gives me following error:  
Transaction Error. Exception thrown in contract code.  
[https://rinkeby.etherscan.io/tx/0xf0a55857fe561e8fb5523bc6f8b9652dfef72dd672bbed037d69b631792eff0b](https://rinkeby.etherscan.io/tx/0xf0a55857fe561e8fb5523bc6f8b9652dfef72dd672bbed037d69b631792eff0b)

Can you please suggest?

Regards,

---

<div class="post-metadata">

**Author:** ![asmel](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.openzeppelin.com/asmel/32/11994_2.png) [@asmel](https://forum.openzeppelin.com/u/asmel)\
**Post date:** [December 20, 2021, 3:19pm UTC](https://forum.openzeppelin.com/t/erc721-cost-is-giving-error/21235/5 "2021-12-20T15:19:23Z")

</div>

Disculapa and do you have that amount of ether to perform that minteo? If you read correctly I said 100000000000000000 wei no ether, but I'm going to test your contract

---

<div class="post-metadata">

**Author:** ![asmel](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.openzeppelin.com/asmel/32/11994_2.png) [@asmel](https://forum.openzeppelin.com/u/asmel)\
**Post date:** [December 20, 2021, 3:38pm UTC](https://forum.openzeppelin.com/t/erc721-cost-is-giving-error/21235/6 "2021-12-20T15:38:20Z")

</div>

The contract works perfectly I made 2 mint, successfully with two accounts the owner and a buyer, which leads me to deduce that you do not have enough ether to make the transaction or you are sending the wrong amount of ether

contract implemented by me 0x7e7c8C7Cfd4C218f62c9AF6afAfD7867BEAC9f88

---

<div class="post-metadata">

**Author:** ![asmel](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.openzeppelin.com/asmel/32/11994_2.png) [@asmel](https://forum.openzeppelin.com/u/asmel)\
**Post date:** [December 20, 2021, 3:38pm UTC](https://forum.openzeppelin.com/t/erc721-cost-is-giving-error/21235/7 "2021-12-20T15:38:36Z")

</div>

> **[RoyalFalcon | 0x7e7c8c7cfd4c218f62c9af6afafd7867beac9f88](https://rinkeby.etherscan.io/address/0x7e7c8c7cfd4c218f62c9af6afafd7867beac9f88)**
>
> The Contract Address 0x7e7c8c7cfd4c218f62c9af6afafd7867beac9f88 page allows users to view the source code, transactions, balances, and analytics for the contract address. Users can also interact and make transactions to the contract directly on...

---

<div class="post-metadata">

**Author:** ![nomanhaq](https://avatars.discourse-cdn.com/v4/letter/n/a88e57/32.png) [@nomanhaq](https://forum.openzeppelin.com/u/nomanhaq)\
**Post date:** [December 21, 2021, 2:39pm UTC](https://forum.openzeppelin.com/t/erc721-cost-is-giving-error/21235/8 "2021-12-21T14:39:12Z")

</div>

@asmel  
Thanks for your reply i can see you are able to mint directly from contract but at application level my minting transactions gets failed.

> **[Rinkeby Transaction Hash (Txhash) Details | Etherscan](https://rinkeby.etherscan.io/tx/0xcaf49251c3e488eec72d34a1686f48df6e0cd80e6f017b557444edb7b0780c61)**
>
> Rinkeby (ETH) detailed transaction info for txhash 0xcaf49251c3e488eec72d34a1686f48df6e0cd80e6f017b557444edb7b0780c61. The transaction status, block confirmation, gas fee, Ether (ETH), and token transfer are shown.

Is there any possibility if we can zoom in tomorrow at any suitable time?

Regards,
