Skip to content

Conversation

@adithyaov
Copy link
Member

Creating a PR for furthering the discussion.

IO ()
writePlutusScript filename (CompiledCodeLang compiledCode) = do
let serialisedScript = serialiseCompiledCode compiledCode
let serialisedScript = V2.serialiseCompiledCode compiledCode
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

serialiseCompiledCode is the same on V3, V2, and V1.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep, I know, it was a part of the investigation why V3 doesn't work.

FilePath ->
CompiledCode a ->
IO ()
writePlutusScriptV3 filename compiledCode = do
Copy link
Member Author

@adithyaov adithyaov Jan 5, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the same as writePlutusScript.
CompiledCodeLang lang a is a custom type I introduced to encode lang as a proxy.
writePlutusScript should work (hopefully - I'll verify this.) for all the options.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as above

@@ -1,4 +1,6 @@
module Onchain.Escrow where
{-# OPTIONS_GHC -fplugin-opt PlutusTx.Plugin:target-version=1.0.0 #-}
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What does this plugin affect?
My (uneducated) guess is that it only affects the logic where compile is used.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, it changes the version of the generated plutus code in the module

import PlutusLedgerApi.V3 qualified as V3
import PlutusTx qualified
import PlutusTx.Builtins (unsafeDataAsI)
import PlutusTx.Builtins.Internal qualified as BI (
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should try to avoid using Internal stuff.
I assume you've used this for testing/hacking.

@@ -1,3 +1,5 @@
{-# OPTIONS_GHC -fplugin-opt PlutusTx.Plugin:target-version=1.0.0 #-}
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can either use macros, or if it becomes too hairy, we can move this to V2/Compiled

@@ -0,0 +1,8 @@
{
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can send datum inline as well.
Using a file will, however, avoid the quirks of shell escaping.
Is it a good idea to generate the datum on demand using dev-local instead?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was just playing with different datums, can be removed

makeAppEnv = do
let policyFilePath = env_LOCAL_CONFIG_DIR </> "policy.plutus"
validatorFilePath = env_LOCAL_CONFIG_DIR </> "validator.plutus"
validatorFilePath = env_LOCAL_CONFIG_DIR </> "validator-v3.plutus"
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should probably abstract this out properly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants