Secure authentication in minting algorithmic tokens?

Hello!

Can anyone gimme a good pointer explaining how my contract can authenticate minting some algorithmic tokens? Specifically, in my DEFI protocol, when someone deposits BTC or ETH, my program must algorithmically mint ERC-20 tokens of the same value as the deposited coins. Questions are:

  1. In this case, what is the most secure way to authenticate such a minting? Is there any safe way to authenticate minting, absolutely hacking-free?
  2. Is there any Gnosis Safe API that I must use for this kind of protocol?
  3. I am very concerned about the hacking possibility in this type of algorithmic token. Any good readings/articles on the security in DEFI would be very much appreciated.

Thanx in advance.

Nick.
PS. I want to express my appreciation to Open Zeppenline and Gnosis.

Are you familiar with the AccessControl library? Sounds like it can provide most of what you are asking for in terms of authenticating a function call.