0

My contract is very simple - it transfers tokens from a user's wallet to an exchange. It is basically this:

contract Strategy is ReentrancyGuard {
  IERC20 private immutable paymentToken;
  Token private immutable strategyToken;

  constructor(IERC20 _paymentToken, Token _strategyToken) {
    paymentToken = _paymentToken;
    strategyToken = _strategyToken;
  }

  // amount (1e18) in strategy tokens
  function deposit(uint256 amount) external payable nonReentrant {
    // Transfer payment token from msg.sender to contract
    paymentToken.transferFrom(msg.sender, address of exchange, amount);

    // Mint strategy token and send it user
    strategyToken.mint(msg.sender, amount);
  }
}

So, as one can see, the actual contract itself does not hold any value, it merely just forwards it. Does it make sense to make this contract upgradeable? I am asking because while having an upgradeable contract seems amazing, it also seems like a hack.

1 Answer 1

2

It really depends of your use case and your users expectations. An upgradable contract means that there is an owner that can change the functions of the contract. If your users expect that your contract is immutable, for instance because they do not trust you, then it should not be upgradable (or at least not by a single owner).

On the other hand, if your users do not care about the immutability of the contract, making it upgradable could give you flexibility to add functionalities in the future.

A third possibility would be to use upgradable contracts, but allowing them to be upgraded only by a decentralized governance mechanism (majority voting of tokens holders, for instance). Many big projects have such a mechanism (Compound, for instance). However, OpenZeppelin does not provide such a complex governance library (their governance module is quite rudimentary).

3
  • This is a great answer, thank you. So I can take it that massive DEFI project (Yearn, Uniswap etc) would never EVER use an upgradeable contract pattern due to the trust issue? Commented Jun 21, 2021 at 17:28
  • Actually, many big projects use an upgradable pattern. However, they also implement a decentralized governance mechanism by which upgrades can only be implemented if they go through that mechanism (majority voting of token holders, for instance). Check Compound as an example. FYI, you can accept answers by clicking on the check mark. I'll edit the answer to specify that.
    – Undead8
    Commented Jun 21, 2021 at 18:06
  • Yeah, i know about accepting answers :) I was just waiting to see if everyone liked your comment as much as I did. But I accepted now. Commented Jun 23, 2021 at 3:28

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.