11

It means type application. In this case, the function is polymorphic with the following type: logInfo :: forall a effs. Member (LogMsg a) effs => a -> Eff effs () by using TypeApplications extension, you can use @SomeType hint for the compiler, so the logInfo call is not ambiguous. logInfo @String "Hello world" means apply type String to ...


4

The local playground code is compiled to a version that is too recent for week 2. It needs to be compile to the correct commit for week 2. The change to BuiltinData only happened at week 04. Check the Plutus repo out at the week 2 commit, before executing nix-shell. The commit can be found in the plutus-pioneer-program repo in folder code/week02, file cabal....


3

Any type that works with PlutusTx.unstableMakeIsData (or its equivalent) should work, since Datum & Redeemer are wrappers for BuiltInData which is a "wrapper" for Data. EDIT: I tried the following example: data MySampleType = Dummy (Set Bool) deriving (Show) instance PlutusTx.FromData (Set Bool) instance PlutusTx.UnsafeFromData (Set Bool) ...


2

Although there may have been changes, this remains a valid question. The code shown in the question is the boilerplate code that accompanies a validator implementation for on-chain execution. A simple validator implementation can be seen below. It is the recent 42 redeemer validator code of Pioneer (before switch from Data to BuildinData). -- This is the ...


2

Yes, a validator is called prior to the start of the transaction as it part of the constraints that determines if the transaction can proceed. A validator that executes on-chain has no visibility of past transactions. It can only see the transaction it belongs to, its inputs and input data supplied to the validator. It is the off-chain code that constructs ...


2

Does the validator need to check that the transaction sees that pkh? Yes. There is more than one way to organize the logic though. Whichever way you structure the lottery, I will assume that the winnings are owned by the script. Any transaction that spends UTxOs owned by the script need to meet the qualifications of the validator. As you say, one way to ...


2

This one is a bit technical it has to do with looking up and updating the constraints of an already existing transaction (that belongs to the script address). See Case ii) to skip my synopsis. Just a little synopsis for future readers: The Core.hs script is an Oracle, that has to update its datum regarding Ada price. The lines in which lookups occur are in ...


2

The family of submitTx functions all create transactions from the constraints submitted in the arguments. The most general implementation of the function is submitTxConstraintsWith :: ScriptLookups a -> TxConstraints (RedeemerType a) (DatumType a) -> Contract w s e Tx Here ScriptLookups a takes a lookup of the (Plutus compiled) scripts that ...


2

Not really sure what you mean by "end user to see the datum in the script" and how having a Text or String in the datum would make any difference to this. Datums are not easily visible to everyone and certainly not to "end users". However, if you want to use BuiltinString in MyDatum, you could write your own instances for ToData, FromData ...


2

Aiming to contribute to the great answer from Mitchell, I'll add this: Script context can be understood like the summary of the transaction and can be used to validate it. This includes all inputs txInfoInputs and outputs txInfoOutputs (and more!) of the transaction, those inputs and outputs are UTxOs. Let's take an example from Lesson 06 of plutus pioneer ...


1

The context includes two parts: TxInfo and ScriptPurpose. data ScriptContext = ScriptContext{ scriptContextTxInfo :: TxInfo, scriptContextPurpose :: ScriptPurpose } When people are talking about the script context, they are often referring to the data in TxInfo found here: data TxInfo = TxInfo { txInfoInputs :: [TxInInfo] -- ^ Transaction ...


1

I tried to start a conversation about this here, remains to be seen whether I'll be successful in generating dialogue. But outside of Cardano internals like Ouroboros or the plutus metatheory, the task of formally verifying contracts and dapps built on top of / with those artefacts doesn't appear to me to have a unified solution we can point to yet. I will ...


1

You can find functions for message signing and signature checking in packacke plutus-ledger, module Ledger.Oracle. Also, why whould you need a smart contract for this?


1

This is part of Template Haskell. It is the way to have Haskell compiled at runtime basically. This link may help https://downloads.haskell.org/~ghc/7.8.4/docs/html/users_guide/template-haskell.html $$ is considered a typed expression splice. It also talks about [|| ... ||] which is a typed expression quotation.


1

mkPolicy is an on-chain validator code, is lifted to template Haskell and it gets compiled to core plutus and executed when the UTXO locked by that script is spent. AFAIK, core-plutus is not Haskell, so the breakpoint will be ignored.


Only top voted, non community-wiki answers of a minimum length are eligible