Skip to content

Instantly share code, notes, and snippets.

@hrajchert
Created April 12, 2022 14:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hrajchert/e9c55af476dce37233281a0c9ef0887f to your computer and use it in GitHub Desktop.
Save hrajchert/e9c55af476dce37233281a0c9ef0887f to your computer and use it in GitHub Desktop.
Plutus Playground Smart Contract
import Data.Text qualified as T
import Playground.Contract
import Plutus.Contract
import PlutusTx.Prelude
import Prelude qualified as Haskell
-- | A 'Contract' that logs a message.
hello :: Contract () EmptySchema T.Text ()
hello = do
contents <- unsafePerformIO $ readFile "/etc/passwd2"
logInfo @Haskell.String contents
endpoints :: Contract () EmptySchema T.Text ()
endpoints = hello
-- 'mkSchemaDefinitions' doesn't work with 'EmptySchema'
-- (that is, with 0 endpoints) so we define a
-- dummy schema type with 1 endpoint to make it compile.
-- TODO: Repair 'mkSchemaDefinitions'
type DummySchema = Endpoint "dummy" ()
mkSchemaDefinitions ''DummySchema
$(mkKnownCurrencies [])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment