The ownership of the DecentralizedStableCoin.sol .... #167
-
I was going through the Stablecoin Defi project. I noticed that that the DecentralizedStableCoin is a ownable contract that is to be owned by the DSCEngine.sol ant the function in the contract i.e burn and mint have onlyOwner modifier. I am trying to understand how DSCEngine contract became the owner of DecentralizedStableCoin ?? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 4 replies
-
Hello @Devshenoyprasad Let me know if you need any extra help. |
Beta Was this translation helpful? Give feedback.
-
How about making the DSCEngine.sol to deploy DecentralizedStableCoin.sol rather that passing the contract address as a parameter to the constructor of DSCEngine.sol?? It will then make DSCEngine the owner of DecentralizedStableCoin i.e the ERC-20 contract. |
Beta Was this translation helpful? Give feedback.
Hello @Devshenoyprasad
Well that is a really good question, let me try to answer it:
This ownership assignment typically happens at the time of deployment or shortly after, when a function is called to set the owner. The contract deployer would call a function to set DSCEngine as the owner of the DecentralizedStableCoin. This function would likely be protected by the onlyOwner modifier to ensure that only the deployer (initial owner) can change the ownership to DSCEngine.
While this design gives DSCEngine a certain level of control over the DecentralizedStableCoin, it's important to note that this isn't truly decentralized. A truly decentralized stablecoin wouldn't have a single owner ent…