1

We have seen many defi hacks taking place one thing i don't understand is how the bug in contract fixed given that smart contracts are immutable. Is it somehow related to delegate call or interfaces.please provide a detailed answer. Eg the furocombo hack, Cream finance flash loan hack etc

Seth jain
  • 23
  • 5

1 Answers1

1

It depends on how the contracts are implemented. There are two main variants:

  1. One or more contracts which interact with each other

  2. One proxy contract which delegates calls to other contracts

With the first option, you can only deploy new contract(s) and migrate users to those contracts, in some way. This is typically not a fun approach, but often the only possible approach.

With the second option, you can quite easily upgrade some of the underlying contracts. This happens by deploying a new contract and telling the proxy contract to switch using the new contract. After that, exactly the same contract calls still work, but there's a new contract doing the logic. And yes, this is related to delegatecalls.

Lauri Peltonen
  • 29,391
  • 3
  • 20
  • 57