Staking contract?


Me and my friend, we are building a token on BSC, that has several utilities. My friend who started the project decided to divide this token ecosystem by several tokens, there is main token that has some built-in utilities, and the next token will be staking one.

So, the process will be like this: People can buy X (main token), then they can stake this X token in Y (stake contract), and in exchange, they will get some Y.

There will be some kind of reward distribution system, but for the sake of simplicity let’s say that on the stake you get a 1% reward.

Now, I found a very well designed contract and I updated it for the 0.8.0 version so I could use openzeppelin goodies in it, it’s just, the structure is kinda complicated so I’m a bit confused about how can I let this Y contract to accept X (that is already deployed).

I have a code, but I don’t really want to share it publicly yet, because it’s a big mess, so it will be good if someone can provide theoretical help about this very simple concept, I can show you my code in private.

P.S contract is standard ERC20, nothing special and so far, on the remix, it doesn’t have any issues, I have test codes ready and will use truffle/ganache to test it more deeply. It could be ready, I just want to make sure that it won’t damage this infrastructure or its users.


Hi makish, welcome to the forums.

so I’m a bit confused about how can I let this Y contract to accept X (that is already deployed).

If Contract X is already deployed, then all Contract Y functions need to do is accept. query, and interact with Token X. If I understand what you’re saying, Contract Y won’t interact (or damage) any sort of functionality with Contract X and will only see the stake of Token X.

I think your main goal is to have Contract Y interact with the Token X, not the Contract X. As long as you keep these ideas separate then I think you will have a successful project.

Below are some examples of how one contract can interact with already deployed tokens.

If in the future if you need to upgrade, then use a proxy as I’m sure you’re aware of from Open Zeppelin.