So I have a working contract code on Remix, but it's written for ERC20 and I need to somehow change it so that it works on BEP20. I'm like really-really new to all of this and can't understand much of Solidity. Sorry if the question is stupid by itself, but I couldn't find any info by myself, so here I am.
I've tried to simply connect some BEP20 files from GitHub, which seem to be essential, and started compiling the code, but obviously it just flooded me with a bunch of different errors. I'd really love if someone could explain what are the main differences between writing code for ERC20 and for BEP20
Here's few definitions just so you can better orient in the context:
From the perspective of Solidity code, there is no difference between ERC-20 and BEP-20 token. So when you deploy the code on Ethereum, it becomes an ERC-20 token - and when you deploy the same code on Binance Smart Chain, it becomes a BEP-20 token.
Here's a sample code for ERC-20/BEP-20 token extending the OpenZeppelin open source library, that already implements all features required by the standard.
The
import
statement above imports theERC20.sol
file from @openzeppelin/contracts NPM package. Make sure that you included this dependency in yourpackage.json
- or that you're using an environment that has this dependency already included (for example Remix IDE).