I need help creating a pegged token

I need some help with creating an ERC20 token that is binded to the price of a BEP20 token. How would I go about doing that? I was thinking some type of contract with the same number of tokens as the BEP20 version and you could swap 1to1? I just don't know how I would go about setting that up.