0

I was digging into this OZ smart contract:

https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/utils/Context.sol

As you may see, it has only two functions to deal with metatxs. I can't figure out why this contract is defined as abstract, as both functions are implemented. Thanks in advance to all of you!

  • I don't know solidity, but it looks to me like those are the default implementations for the methods in the contract. The contract being abstract means they cannot be directly instantiated, they're only meant to be derived from. And the methods are `virtual` meaning they're meant to be overridden in things that derive from the contract, but overriding/implementing those methods is not absolutely necessary. – Matt U Sep 27 '21 at 02:12

1 Answers1

0

The Context contract was made abstract in the pull request #2229. One of the contributors links to the issue #8162 for explanation:

it seems like what the keyword does is mark the contract as non-deployable (i.e. it needs to be inherited from). Because contracts missing function implementations are always non-deployable, they require abstract.

From my understanding, their reason was just to explicitly say "This contract has no use on its own, and should not be deployable (on its own)."

Petr Hejda
  • 40,554
  • 8
  • 72
  • 100