Last active
March 24, 2021 04:23
-
-
Save ngoluuduythai/a041f54e88754f300134425921326e8c to your computer and use it in GitHub Desktop.
Plutus Playground Smart Contract
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import qualified Data.Text as T | |
import Language.Plutus.Contract hiding (when) | |
import Language.PlutusTx.Prelude | |
import Playground.Contract | |
-- | A 'Contract' that logs a message. | |
-- public Contract<BlockchainActions, T.Text, void) hello(){ | |
-- return logInfo(@string "Hello, world"); | |
-- } | |
-- T.Text is error | |
-- BlockchainActions or schema contains effects as producing transactions, collecting | |
-- inputs from users, and watching the blockchain for chanegs | |
-- type BlockchainActions = | |
-- AwaitSlot | |
-- .\/ WatchAddress | |
-- .\/ WriteTx | |
-- .\/ UtxoAt | |
-- .\/ OwnPubKey | |
-- .\/ TxConfirmation | |
-- .\/ ContractInstanceNotify | |
-- .\/ OwnId | |
-- CustomBlockChainActions | |
hello :: Contract BlockchainActions T.Text () | |
hello = logInfo @String "Hello, world" | |
-- | Log a message at the 'Info' level | |
-- logInfo :: ToJSON a => a -> Contract w s e () | |
-- logInfo = Contract . L.logInfo . toJSON | |
-- . => f(g(x)) Contract(L.logInfo(a.toJSON))) | |
-- | endpoints talk plutus what to show in the ui | |
endpoints :: Contract BlockchainActions T.Text () | |
endpoints = hello | |
-- What schema we using | |
mkSchemaDefinitions ''BlockchainActions | |
-- use for plutus scripts | |
$(mkKnownCurrencies []) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[0,[]] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment