This doesn't exactly answer your question but could be useful for you and others.
Since cardano-cli
1.31, there is a new command to calculate the minimum required ADA for a transaction output:
cardano-cli transaction calculate-min-required-utxo
Usage: cardano-cli transaction calculate-min-required-utxo
[ --byron-era
| --shelley-era
| --allegra-era
| --mary-era
| --alonzo-era
]
(--genesis FILE | --protocol-params-file FILE)
--tx-out ADDRESS VALUE
[ --tx-out-datum-hash HASH
| --tx-out-datum-hash-file FILE
| --tx-out-datum-hash-value JSON VALUE
| --tx-out-datum-embed-file FILE
| --tx-out-datum-embed-value JSON VALUE
]
Calculate the minimum required UTxO for a transaction output.