user4596: In week 5 of plutus-pioneer-program with NFT example this plutus minting policy code is provided:
{-# INLINABLE mkPolicy #-}
mkPolicy :: TxOutRef -> TokenName -> () -> ScriptContext -> Bool
mkPolicy oref tn () ctx = traceIfFalse "UTxO not consumed"   hasUTxO           &&
                          traceIfFalse "wrong amount minted" checkMintedAmount
  where
    info :: TxInfo
    info = scriptContextTxInfo ctx

    hasUTxO :: Bool
    hasUTxO = any (\i -> txInInfoOutRef i == oref) $ txInfoInputs info

    checkMintedAmount :: Bool
    checkMintedAmount = case flattenValue (txInfoForge info) of
        [(cs, tn', amt)] -> cs  == ownCurrencySymbol ctx && tn' == tn && amt == 1
        _                -> False

Script validates if minted NFT is 1. Here are my questions regarding one-time minting:

Is this an example of a one-time policy script which is referenced in Cardano documentation here ?
If this is a one-time minting policy, how does it ensure that only one and only NFT is to be minted with this minting policy? What stops me of instead minting many NFS with single transaction creating many transactions to mint many NFTS one by one?
If this is not a one-time minting policy, how does one-time policy actually look like? How does it ensure that only one token or NFT is to be minted in Cardano network?
Is it possible and if so how to secure the total amount to be minted with minting policy? How would simplest example of that plutus script code look like?
Is it possible to create such minting policy, that it allow to mint only if total minted token amount is not reached and if so how?
Is it possible to create such minting policy, that total amount to be minted is dependent on the time (slot). For example by Monday total amount minted can be 10000, but by Tuesday it can be 20000?


user2537: Yes, this is an example of a "one-time minting policy" referred to in the Cardano documentation.
The policy ensures that only one NFT is minted by a combination of i) being parametrised with a specific UTxO that needs to be consumed by the transaction (checked by hasUTxO) and ii) checking that the total mint quantity is 1. As all UTxOs are unique, this policy can only succeed one time and then never again. The parametrisation ensures that the NFT currency symbol depends on this UTxO, so that if you define the same policy with another UTxO it would not be the same NFT.
I did not understand the question in bullet point 4.
To get a minting policy that allows to mint up to a total fixed supply, I would combine the policy with a script UTxO that keeps track of the minted value in the datum. You need to put an NFT in this script UTxO as well and the minting policy would need to check the presence of it in the transaction and delegate the validation to the script. The script can then check the newly minted value and apply some logic, like checking the weekday. But it would be much easier to just mint the total quantity in one transaction and then distribute the tokens with another mechanism.

4596: <p>In week 5 of plutus-pioneer-program with NFT example this plutus minting policy code is provided:</p>
<pre><code>{-# INLINABLE mkPolicy #-}
mkPolicy :: TxOutRef -&gt; TokenName -&gt; () -&gt; ScriptContext -&gt; Bool
mkPolicy oref tn () ctx = traceIfFalse &quot;UTxO not consumed&quot;   hasUTxO           &amp;&amp;
                          traceIfFalse &quot;wrong amount minted&quot; checkMintedAmount
  where
    info :: TxInfo
    info = scriptContextTxInfo ctx

    hasUTxO :: Bool
    hasUTxO = any (\i -&gt; txInInfoOutRef i == oref) $ txInfoInputs info

    checkMintedAmount :: Bool
    checkMintedAmount = case flattenValue (txInfoForge info) of
        [(cs, tn', amt)] -&gt; cs  == ownCurrencySymbol ctx &amp;&amp; tn' == tn &amp;&amp; amt == 1
        _                -&gt; False
</code></pre>
<p>Script validates if minted NFT is 1. Here are my questions regarding one-time minting:</p>
<ul>
<li>Is this an example of a one-time policy script which is referenced in <a href="https://docs.cardano.org/native-tokens/learn#:%7E:text=locked%20mint%20policy-,One%2Dtime%20mint%20policy,-Note%3A%20There%20are" rel="nofollow noreferrer">Cardano documentation here</a> ?</li>
<li>If this <em>is</em> a one-time minting policy, how does it ensure that only one and only NFT is to be minted with this minting policy? What stops me of instead minting many NFS with single transaction creating many transactions to mint many NFTS one by one?</li>
<li>If this is not a one-time minting policy, how does one-time policy actually look like? How does it ensure that only one token or NFT is to be minted in Cardano network?</li>
<li>Is it possible and if so how to secure the total amount to be minted with minting policy? How would simplest example of that plutus script code look like?</li>
<li>Is it possible to create such minting policy, that it allow to mint only if total minted token amount is not reached and if so how?</li>
<li>Is it possible to create such minting policy, that total amount to be minted is dependent on the time (slot). For example by Monday total amount minted can be 10000, but by Tuesday it can be 20000?</li>
</ul>
 2537: <p>Yes, this is an example of a &quot;one-time minting policy&quot; referred to in the Cardano documentation.</p>
<p>The policy ensures that only one NFT is minted by a combination of i) being parametrised with a specific UTxO that needs to be consumed by the transaction (checked by <code>hasUTxO</code>) and ii) checking that the total mint quantity is 1. As all UTxOs are unique, this policy can only succeed one time and then never again. The parametrisation ensures that the NFT currency symbol depends on this UTxO, so that if you define the same policy with another UTxO it would not be the same NFT.</p>
<p>I did not understand the question in bullet point 4.</p>
<p>To get a minting policy that allows to mint up to a total fixed supply, I would combine the policy with a script UTxO that keeps track of the minted value in the datum. You need to put an NFT in this script UTxO as well and the minting policy would need to check the presence of it in the transaction and delegate the validation to the script. The script can then check the newly minted value and apply some logic, like checking the weekday. But it would be much easier to just mint the total quantity in one transaction and then distribute the tokens with another mechanism.</p>
