# Help! I don't know whats wrong with my code but

**URL:** <https://forum.openzeppelin.com/t/help-i-dont-know-whats-wrong-with-my-code-but/7771>\
**Category:** Contracts\
**Tags:** erc20\
**Created:** [May 4, 2021, 6:56am UTC](https://forum.openzeppelin.com/t/help-i-dont-know-whats-wrong-with-my-code-but/7771 "2021-05-04T06:56:02Z")\
**Posts on this page:** 18\
**Page:** 1

<div class="post-metadata">

**Author:** ![lzodjkfas](https://avatars.discourse-cdn.com/v4/letter/l/bcef8e/32.png) [@lzodjkfas](https://forum.openzeppelin.com/u/lzodjkfas)\
**Post date:** [May 4, 2021, 6:56am UTC](https://forum.openzeppelin.com/t/help-i-dont-know-whats-wrong-with-my-code-but/7771/1 "2021-05-04T06:56:02Z")

</div>

Using solidity 0.6.12 to code, pretty new to coding here.  
Link to code - [https://github.com/TheBroCodeCrypto/smartcontractkit/blob/main/The%20Bro%20Code%20code.txt](https://github.com/TheBroCodeCrypto/smartcontractkit/blob/main/The%20Bro%20Code%20code.txt)

Selected “thebrocode” token to diploy, compiled in different EVM, doesnt work. This is the latest error:

| status | false Transaction mined but execution failed |
| --- | --- |
| transaction hash | 0xd0e200b54f0ec1360957807ed3524e453dc328895730e1b38784e3f7aa84f700 Copy value to clipboard |
| from | 0x242e9Eb81911c56E4271835a983088788C61556E Copy value to clipboard |
| to | TheBroCode.(constructor) Copy value to clipboard |
| gas | 3000000 gas Copy value to clipboard |
| transaction cost | 694728 gas Copy value to clipboard |
| hash | 0xd0e200b54f0ec1360957807ed3524e453dc328895730e1b38784e3f7aa84f700 Copy value to clipboard |
| input | 0x60c…c0033 Copy value to clipboard |
| decoded input | {} Copy value to clipboard |
| decoded output | - Copy value to clipboard |
| logs | Copy value to clipboard Copy value to clipboard |
| value | 0 wei |

Would appreciate if someone can help please!

---

<div class="post-metadata">

**Author:** ![FreezyEx](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.openzeppelin.com/freezyex/32/5498_2.png) [@FreezyEx](https://forum.openzeppelin.com/u/FreezyEx)\
**Post date:** [May 4, 2021, 10:51am UTC](https://forum.openzeppelin.com/t/help-i-dont-know-whats-wrong-with-my-code-but/7771/2 "2021-05-04T10:51:40Z")

</div>

Can you explain when you get this error? WHat are you trying to do? What function are you calling?

From the code I understand that you are copying Safemoon right?  
First thing to do is to change Router address beacuse the one you are using is Router V1 and Pancakeswap migrated to Router v2

---

<div class="post-metadata">

**Author:** ![FreezyEx](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.openzeppelin.com/freezyex/32/5498_2.png) [@FreezyEx](https://forum.openzeppelin.com/u/FreezyEx)\
**Post date:** [May 4, 2021, 11:39am UTC](https://forum.openzeppelin.com/t/help-i-dont-know-whats-wrong-with-my-code-but/7771/4 "2021-05-04T11:39:40Z")

</div>

when you deploy try setting 1 wei

---

<div class="post-metadata">

**Author:** ![lzodjkfas](https://avatars.discourse-cdn.com/v4/letter/l/bcef8e/32.png) [@lzodjkfas](https://forum.openzeppelin.com/u/lzodjkfas)\
**Post date:** [May 4, 2021, 11:44am UTC](https://forum.openzeppelin.com/t/help-i-dont-know-whats-wrong-with-my-code-but/7771/5 "2021-05-04T11:44:49Z")

</div>

Same error code popped up “Internal JSON-RPC error. { “code”: -32000, “message”: “execution reverted” }”

---

<div class="post-metadata">

**Author:** ![FreezyEx](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.openzeppelin.com/freezyex/32/5498_2.png) [@FreezyEx](https://forum.openzeppelin.com/u/FreezyEx)\
**Post date:** [May 4, 2021, 11:48am UTC](https://forum.openzeppelin.com/t/help-i-dont-know-whats-wrong-with-my-code-but/7771/6 "2021-05-04T11:48:38Z")

</div>

can you show us the deploy page?

---

<div class="post-metadata">

**Author:** ![FreezyEx](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.openzeppelin.com/freezyex/32/5498_2.png) [@FreezyEx](https://forum.openzeppelin.com/u/FreezyEx)\
**Post date:** [May 4, 2021, 11:55am UTC](https://forum.openzeppelin.com/t/help-i-dont-know-whats-wrong-with-my-code-but/7771/8 "2021-05-04T11:55:22Z")

</div>

How many bnb do you have in your wallet?  
Check also that you are on mainnet  
From the image I think that you are on testnet

---

<div class="post-metadata">

**Author:** ![lzodjkfas](https://avatars.discourse-cdn.com/v4/letter/l/bcef8e/32.png) [@lzodjkfas](https://forum.openzeppelin.com/u/lzodjkfas)\
**Post date:** [May 4, 2021, 11:57am UTC](https://forum.openzeppelin.com/t/help-i-dont-know-whats-wrong-with-my-code-but/7771/9 "2021-05-04T11:57:49Z")

</div>

I’m on testnet now to check if I get a X or green tick and I keep getting red X. I’m not using real money till I can deploy it successfully on testnet.

P.s. I’ve already tried to deploy 4 times with real BNB and they all failed. I think it has something to do with gas

---

<div class="post-metadata">

**Author:** ![FreezyEx](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.openzeppelin.com/freezyex/32/5498_2.png) [@FreezyEx](https://forum.openzeppelin.com/u/FreezyEx)\
**Post date:** [May 4, 2021, 12:08pm UTC](https://forum.openzeppelin.com/t/help-i-dont-know-whats-wrong-with-my-code-but/7771/10 "2021-05-04T12:08:08Z")

</div>

If you are on testnet you must use Router testnet address

---

<div class="post-metadata">

**Author:** ![lzodjkfas](https://avatars.discourse-cdn.com/v4/letter/l/bcef8e/32.png) [@lzodjkfas](https://forum.openzeppelin.com/u/lzodjkfas)\
**Post date:** [May 4, 2021, 12:14pm UTC](https://forum.openzeppelin.com/t/help-i-dont-know-whats-wrong-with-my-code-but/7771/11 "2021-05-04T12:14:22Z")

</div>

Router testnet? I’m on BSC testnet

---

<div class="post-metadata">

**Author:** ![lzodjkfas](https://avatars.discourse-cdn.com/v4/letter/l/bcef8e/32.png) [@lzodjkfas](https://forum.openzeppelin.com/u/lzodjkfas)\
**Post date:** [May 4, 2021, 12:31pm UTC](https://forum.openzeppelin.com/t/help-i-dont-know-whats-wrong-with-my-code-but/7771/12 "2021-05-04T12:31:51Z")

</div>

I just looked it up, its a crosschain testnet. I have used BSC and eth, both have same errors

---

<div class="post-metadata">

**Author:** ![FreezyEx](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.openzeppelin.com/freezyex/32/5498_2.png) [@FreezyEx](https://forum.openzeppelin.com/u/FreezyEx)\
**Post date:** [May 4, 2021, 12:48pm UTC](https://forum.openzeppelin.com/t/help-i-dont-know-whats-wrong-with-my-code-but/7771/13 "2021-05-04T12:48:36Z")

</div>

yes but you must use Pancake Router address for testnet. It is different from mainnet

---

<div class="post-metadata">

**Author:** ![lzodjkfas](https://avatars.discourse-cdn.com/v4/letter/l/bcef8e/32.png) [@lzodjkfas](https://forum.openzeppelin.com/u/lzodjkfas)\
**Post date:** [May 4, 2021, 1:07pm UTC](https://forum.openzeppelin.com/t/help-i-dont-know-whats-wrong-with-my-code-but/7771/14 "2021-05-04T13:07:23Z")

</div>

But I have the same results if I use BNB smart chain though. I tried googling it and everywhere is just asking me to setup bsc testnet, which is what I’m using. Can you link the setup please and I’ll try it?

---

<div class="post-metadata">

**Author:** ![FreezyEx](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.openzeppelin.com/freezyex/32/5498_2.png) [@FreezyEx](https://forum.openzeppelin.com/u/FreezyEx)\
**Post date:** [May 4, 2021, 7:13pm UTC](https://forum.openzeppelin.com/t/help-i-dont-know-whats-wrong-with-my-code-but/7771/15 "2021-05-04T19:13:01Z")

</div>

No I am saying that in your contract is harcoded pancakeswap router address. If you are testing on bsc testnet you have to use Pancakeswap router address for testnet

---

<div class="post-metadata">

**Author:** ![lzodjkfas](https://avatars.discourse-cdn.com/v4/letter/l/bcef8e/32.png) [@lzodjkfas](https://forum.openzeppelin.com/u/lzodjkfas)\
**Post date:** [May 5, 2021, 1:13am UTC](https://forum.openzeppelin.com/t/help-i-dont-know-whats-wrong-with-my-code-but/7771/16 "2021-05-05T01:13:21Z")

</div>

I have tried it from mainnet it still doesnt work ☹  
creation of TheBroCode errored: Error: [ethjs-query] while formatting outputs from RPC ‘{“value”:{“code”:-32603,“data”:{“code”:-32000,“message”:“intrinsic gas too low”}}}’

Changed the gas up to 5

---

<div class="post-metadata">

**Author:** ![Skyge](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.openzeppelin.com/skyge/32/343_2.png) [@Skyge](https://forum.openzeppelin.com/u/Skyge)\
**Post date:** [May 6, 2021, 1:09am UTC](https://forum.openzeppelin.com/t/help-i-dont-know-whats-wrong-with-my-code-but/7771/17 "2021-05-06T01:09:44Z")

</div>

I think on the BSC-Testnet, the gas should be 10.

---

<div class="post-metadata">

**Author:** ![lzodjkfas](https://avatars.discourse-cdn.com/v4/letter/l/bcef8e/32.png) [@lzodjkfas](https://forum.openzeppelin.com/u/lzodjkfas)\
**Post date:** [May 6, 2021, 3:19am UTC](https://forum.openzeppelin.com/t/help-i-dont-know-whats-wrong-with-my-code-but/7771/18 "2021-05-06T03:19:43Z")

</div>

I tried 1000 but it still doesnt work ☹

---

<div class="post-metadata">

**Author:** ![Skyge](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.openzeppelin.com/skyge/32/343_2.png) [@Skyge](https://forum.openzeppelin.com/u/Skyge)\
**Post date:** [May 6, 2021, 3:23am UTC](https://forum.openzeppelin.com/t/help-i-dont-know-whats-wrong-with-my-code-but/7771/19 "2021-05-06T03:23:01Z")

</div>

No, I think the gas price on the BSC-Testnet is a fixed value. just 10 gWei.

---

<div class="post-metadata">

**Author:** ![lzodjkfas](https://avatars.discourse-cdn.com/v4/letter/l/bcef8e/32.png) [@lzodjkfas](https://forum.openzeppelin.com/u/lzodjkfas)\
**Post date:** [May 6, 2021, 3:23am UTC](https://forum.openzeppelin.com/t/help-i-dont-know-whats-wrong-with-my-code-but/7771/20 "2021-05-06T03:23:33Z")

</div>

Yes I tried 10 as well, same error ☹
