2

I have already deployed a contract on Binance Smart Chain. I now would like to add time lock functionality to this contract to lock some of the tokens for a time period. I know that smart contracts are immutable so there is no way to change the already deployed contract. My question is that : Can I deploy a new contract that only has the time lock function that interacts with my already deployed contract and lock some tokens of the already deployed contract ? In a nutshell, what I want to do is to add a new function to an already deployed contract with a new contract. Is this possible ? I think it should, because otherwise there won't be any ways to add new functionalities to a deployed contract but I couldn't find any tutorials on that. If there is a way, can you guys point me in the right direction ?

Thank you very much.

1 Answer 1

1

it depends on planning ahead and there might not be enough of that in this case.

Think of it like a spaceship you shoot into space, on its way to another planet and going as fast as your engineers know how to make it go. There is no way to catch up to it but you exchange messages by radio signals. So ... if you had the foresight to create a language and send some spare parts, it might be able to repair itself or upgrade itself but such possibilities are always limited to tools you put on board before launch.

Upgradeability patterns are non-trivial and need to be baked in early.

A time lock function can be deployed as a stand-alone contract that accepts tokens, locks them and gives them back. Whether this solves your problem or not depends on what you want to accomplish. For example, your first contract will not be able to talk to the second contract because the interface to the new contract is unknown to the first. The second contract would be able to talk to the first contract because you could code that.

If you don't want any integrations, then it might be possible to use the second time lock contract as a simple stand-alone service.

Hope it helps.

4
  • Hello Rob, thank you for the answer. I just need a second contract that locks some tokens for the first contract. Could you suggest any documentation/tutorials on this? Commented May 21, 2021 at 20:03
  • check out team.finance/lockups Commented May 21, 2021 at 20:06
  • I would prefer to write my own contract if possible .. Commented May 21, 2021 at 20:07
  • Check out the openzeppelin time-lock contact for a starting point. Commented May 22, 2021 at 5:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.