<blockquote>
<p>being that I have 2 validators can I define what utxo goes for each?</p>
</blockquote>
<p>No, both scripts have visibility of all inputs and outputs of the transaction.</p>
<p>You can try ensuring that <a href="https://plutus.readthedocs.io/en/latest/reference/writing-scripts/common-weaknesses/double-satisfaction.html#unique-outputs" rel="nofollow noreferrer">unique outputs</a> are checked for each script.</p>

CC BY-SA 4.0
2022-10-07T11:55:10.970Z
I have distinct outputs how do I see them in the validator?
Cristovao Morgado
CC BY-SA 4.0
2022-10-08T13:45:53.047Z
Your can access transaction outputs with `txInfoOutputs info`
james
CC BY-SA 4.0
2022-10-07T11:38:33.123Z
2022-10-07T11:38:33.123Z
james
<p>I'm building a use case where a person can buy a token and depending on the amount of ADA spent, he gets X tokens and a Special NFT.</p>
<p>Each Validator represent the policy Id of these native tokens I'm creating.</p>
<p>Now I must prevent anyone from minting without paying and off course check if the ADA is the value of the mint</p>
<pre><code>mintWithFriend :: MintParams -&gt; Contract w FreeSchema Text ()
mintWithFriend mp = do 
        let  destinations       = paymentTo mp
             referralAddr       = pubKeyHashAddress (referral destinations) Nothing
        now                     &lt;- currentTime
        utxosReferral           &lt;- utxosAt referralAddr         
        let
            vals                =  (_ciTxOutValue &lt;$&gt; (snd &lt;$&gt; Map.toList utxosReferral))            
            referralOk          =  extractLevel (getTot vals []) 0

            yacada              = Value.singleton yacadaSymbol (U.yacadaName) (U.calculateYacada $ mpAdaAmount mp) -- coins for customer
            yacadaNft           = Value.singleton yacadaNFTSymbol  (U.giveReferralNFTName (mpAdaAmount mp) now)  1 -- NFT for is base referral
            yacadaReferralNft   = Value.singleton yacadaNFTSymbol  (U.upgradeReferralNFTName (referralOk+1) now)  1 -- upgrade for the referral account
            treasuryAdas        = Ada.lovelaceValueOf $ U.treasuryAda (mpAdaAmount mp) referralOk 
            referralAdas        = Ada.lovelaceValueOf $ U.referralAda (mpAdaAmount mp) referralOk            
            lookups             = Constraints.mintingPolicy policy 
                                    &lt;&gt; Constraints.mintingPolicy levelPolicy 
            payment             = Constraints.mustPayToPubKey (treasury destinations) treasuryAdas 
                                    &lt;&gt; Constraints.mustPayToPubKey (referral destinations) (referralAdas &lt;&gt;  yacadaReferralNft)                             
            mint                = Constraints.mustMintValue (yacada &lt;&gt; yacadaNft &lt;&gt; yacadaReferralNft)                              
            tx                  = mint &lt;&gt; payment
                                                             
        ledgerTx &lt;- submitTxConstraintsWith @Void lookups tx
        void $ awaitTxConfirmed $ getCardanoTxId ledgerTx
</code></pre>
<p>On this Off-chain contract, I'm building such transaction.</p>
<p>The <strong>policy</strong> and <strong>LevelPolicy</strong> are my 2 validators.
the only utxo sent are the payment.</p>
<p>being that I have 2 validators can I define what utxo goes for each?</p>
<pre><code>{-# INLINABLE yacadaPolicy #-}
yacadaPolicy ::  () -&gt; PlutusV1.ScriptContext -&gt; Bool
yacadaPolicy _ ctx  =  
    traceIfFalse &quot;not ok&quot; True
       
    where        
        allOk :: Bool
        allOk = True
        
        info :: TxInfo
        info = scriptContextTxInfo ctx

        minted :: Value
        minted = txInfoMint info

        mintedValue :: [(CurrencySymbol, TokenName, Integer)]
        mintedValue = flattenValue (minted)

        -- ?? Paied amount ?? --
        -- ?? amount of yacada == minted amount ??
        -- ?? name of yacadaNFT == level given by amount of ADA &amp;&amp; quantity == 1
        -- ?? did the treasury account received the ADA
        -- ?? did the referral NFT name correct quantity = 1??
        -- ?? did the referral received ADA and new NFT
      
</code></pre>
<p>The full source is <a href="https://github.com/cmorgado/yacada_learning" rel="nofollow noreferrer">https://github.com/cmorgado/yacada_learning</a></p>
<p>Many thanks in advancednat</p>

<minting><validation><mkvalidator>
2 Validators for one Transaction
# 2 Validators for one Transaction

(Asked by: username_0 on 2022-10-07)

I'm building a use case where a person can buy a token and depending on the amount of ADA spent, he gets X tokens and a Special NFT.
Each Validator represent the policy Id of these native tokens I'm creating.
Now I must prevent anyone from minting without paying and off course check if the ADA is the value of the mint
mintWithFriend :: MintParams -> Contract w FreeSchema Text ()
mintWithFriend mp = do 
        let  destinations       = paymentTo mp
             referralAddr       = pubKeyHashAddress (referral destinations) Nothing
        now                     <- currentTime
        utxosReferral           <- utxosAt referralAddr         
        let
            vals                =  (_ciTxOutValue <$> (snd <$> Map.toList utxosReferral))            
            referralOk          =  extractLevel (getTot vals []) 0

            yacada              = Value.singleton yacadaSymbol (U.yacadaName) (U.calculateYacada $ mpAdaAmount mp) -- coins for customer
            yacadaNft           = Value.singleton yacadaNFTSymbol  (U.giveReferralNFTName (mpAdaAmount mp) now)  1 -- NFT for is base referral
            yacadaReferralNft   = Value.singleton yacadaNFTSymbol  (U.upgradeReferralNFTName (referralOk+1) now)  1 -- upgrade for the referral account
            treasuryAdas        = Ada.lovelaceValueOf $ U.treasuryAda (mpAdaAmount mp) referralOk 
            referralAdas        = Ada.lovelaceValueOf $ U.referralAda (mpAdaAmount mp) referralOk            
            lookups             = Constraints.mintingPolicy policy 
                                    <> Constraints.mintingPolicy levelPolicy 
            payment             = Constraints.mustPayToPubKey (treasury destinations) treasuryAdas 
                                    <> Constraints.mustPayToPubKey (referral destinations) (referralAdas <>  yacadaReferralNft)                             
            mint                = Constraints.mustMintValue (yacada <> yacadaNft <> yacadaReferralNft)                              
            tx                  = mint <> payment
                                                             
        ledgerTx <- submitTxConstraintsWith @Void lookups tx
        void $ awaitTxConfirmed $ getCardanoTxId ledgerTx

On this Off-chain contract, I'm building such transaction.
The policy and LevelPolicy are my 2 validators.
the only utxo sent are the payment.
being that I have 2 validators can I define what utxo goes for each?
{-# INLINABLE yacadaPolicy #-}
yacadaPolicy ::  () -> PlutusV1.ScriptContext -> Bool
yacadaPolicy _ ctx  =  
    traceIfFalse "not ok" True
       
    where        
        allOk :: Bool
        allOk = True
        
        info :: TxInfo
        info = scriptContextTxInfo ctx

        minted :: Value
        minted = txInfoMint info

        mintedValue :: [(CurrencySymbol, TokenName, Integer)]
        mintedValue = flattenValue (minted)

        -- ?? Paied amount ?? --
        -- ?? amount of yacada == minted amount ??
        -- ?? name of yacadaNFT == level given by amount of ADA && quantity == 1
        -- ?? did the treasury account received the ADA
        -- ?? did the referral NFT name correct quantity = 1??
        -- ?? did the referral received ADA and new NFT
      

The full source is https://github.com/cmorgado/yacada_learning
Many thanks in advancednat

**Tags:** minting, validation, mkvalidator

---

## 1 answers

### Answer by username_1 on 2022-10-07. Score: 0 | Accepted answer

> being that I have 2 validators can I define what utxo goes for each?

No, both scripts have visibility of all inputs and outputs of the transaction.

You can try ensuring that [unique outputs](https://plutus.readthedocs.io/en/latest/reference/writing-scripts/common-weaknesses/double-satisfaction.html#unique-outputs) are checked for each script.

> **Comments:**
> **username_0**: I have distinct outputs how do I see them in the validator?  
> **username_1**: Your can access transaction outputs with `txInfoOutputs info`  

---

