0

The OpenZeppelin PaymentSplitter contract has a release() function that sends ETH out to account holders. It's a public virtual function. But, if I go to override it, it won't compile b/c it's got private vars inside. My ultimate goal is to restrict release() so that random people can't just fire it off via Etherscan -- for example making it onlyOwner or otherwise restricting it to a role, and/or making it internal instead of public? I'm wondering what the best approach would be. Seems like I could copy the entire solidity file into my own contract, but I'm wondering if a more elegant approach exists. Ideas/thoughts appreciated!

Jim Dee
  • 51
  • 7

1 Answers1

0

Just to document a working answer: I did copy the entire contract and then made release() internal. Everything seems to work fine that way, although I'm still unsure whether some more elegant way exists.

Jim Dee
  • 51
  • 7
  • Wanted to document a few things, just in case anyone else is searching for this same thing. What I wanted to do was to restrict the OpenZeppelin release() functions in some way, as I had other payments I needed my contract to send out prior to anyone firing OZ's release() function. Ultimately, the answer was in overriding along w/ the "super" keyword (which I didn't know about, but which helped me). Anyway, while you can't override AND change the visibility (to internal), you CAN override and add a role restriction like onlyOwner. So, that combo worked for me and kept everything tidy. – Jim Dee Nov 16 '22 at 19:12