Within my system, there is a mother smart contract capable of breeding identical baby smart contracts. In general, a certain action needs to be done in the baby smart contracts ( at some point ) to reach the business goal. checkUpkeep( )
checks the target condition, and if execution is needed, performUpkeep( )
takes care of that.
Now the question is here: In terms of efficiency, compatibility, and scalability which of the design patterns below is preferable?
a) Putting checkUpkeep( )
and performUpkeep( )
in the mother contract which keeps track of all baby contracts. In this approach, the checkUpkeep()
function of the mother smart contract should check the baby's target condition and execute performUpkeep()
for that specific baby contract, if needed.
b) Putting checkUpkeep( )
and performUpkeep( )
at every baby contract, so babies can check their condition themselves and do the required action if required.
That being said, Chainlink says each Upkeep contract should be funded with at least 5 LINKs after getting registered. Clearly, this makes the second option less efficient because in my case, in total, only one performUpkeep( )
is needed to get the smart contract to its goal. This mandatory LINK limit leaves the smart contracts of my second approach with a lot of unused LINKs which I don't find reasonable.
However, I'm unsure about the first approach as well since the mother smart contract should constantly communicate with external contracts and the cost of executing external calls is way higher than internal interactions.