Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: add a section on simple scripts #96

Merged
merged 5 commits into from
Oct 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions src/pages/additional-features/_meta.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{
"blueprint": "Blueprint"
}
"blueprint": "Blueprint",
"simple-scripts": "Simple Scripts"
}
7 changes: 7 additions & 0 deletions src/pages/additional-features/simple-scripts.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Simple Scripts
Copy link
Member Author

Choose a reason for hiding this comment

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

I'd just prefer "Simple Scripts", why ".. in Atlas"? And Native/Timelock are just other names of simple scripts.

4TT1L4 marked this conversation as resolved.
Show resolved Hide resolved

Atlas supports simple scripts, also known as native and timelock scripts. The functionality of simple scripts is explained in the ledger design document of Shelley & Mary era [here](https://github.com/IntersectMBO/cardano-ledger) and also in [cardano-node-wiki](https://github.com/input-output-hk/cardano-node-wiki/blob/main/docs/reference/simple-scripts.md).
Copy link
Member Author

Choose a reason for hiding this comment

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

I'd avoid " which are key components in building transactions on the Cardano blockchain. These scripts are critical for establishing spending conditions, such as multisig requirements or timelocks."


Simple scripts can be specified via exposed constructors of [`GYSimpleScript`](https://haddock.atlas-app.io/GeniusYield-Types-Script-SimpleScript.html#t:GYSimpleScript). They can also be read from their JSON representation as `GYSimpleScript` has a [`FromJSON`](https://hackage.haskell.org/package/aeson-2.2.3.0/docs/Data-Aeson.html#t:FromJSON) instance. We also provide a utility function, [`readSimpleScript`](https://haddock.atlas-app.io/GeniusYield-Types-Script-SimpleScript.html#v:readSimpleScript), to read JSON representation from a file.
Copy link
Member Author

@sourabhxyz sourabhxyz Oct 7, 2024

Choose a reason for hiding this comment

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

This suggestion, "...type, which represents native and timelock scripts in Atlas. This data type can be used for both creating and interacting with simple scripts programmatically. " is unnecessary. It is already mentioned in beginning of sentence that this is used to specify simple scripts. And the later part "used for both creating and interacting with simple scripts programmatically" is not required as it is not limited to this way of specifying simple script inside Atlas and it is also clear with other paras in this doc.


Simple scripts can also be attached to UTxO outputs, allowing them to be used later as reference scripts when building transactions. You can find an example [here](https://github.com/geniusyield/atlas/blob/main/tests-privnet/GeniusYield/Test/Privnet/SimpleScripts.hs), that demonstrates how to interact with simple scripts, both when used as a reference and when given directly for transaction validation.