-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
adding new page Roles in Marlowe (#205)
* adding new page Roles in Marlowe * Minor tweaks * further edits, removed now redundant content about role tokens from Payouts DApp prototype page * further edits * removed unnecessary statement about Nami and Lace * minor edits --------- Co-authored-by: olgahryniuk <[email protected]>
- Loading branch information
1 parent
edd8a43
commit dd22574
Showing
6 changed files
with
50 additions
and
11 deletions.
There are no files selected for viewing
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
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
--- | ||
title: Roles in Marlowe | ||
sidebar_position: 5 | ||
--- | ||
|
||
Generally speaking, participants are actors in a smart contract. These participants fulfill roles that specify the ability to execute certain actions in the contract. | ||
|
||
Roles can be hard coded addresses, pre-determined before launching a contract or determined after launching a contract. | ||
|
||
These roles are uniquely identified using role tokens. | ||
|
||
## Role tokens | ||
|
||
Participants hold role tokens in their wallets as assets or NFTs. | ||
|
||
Role tokens are used to identify roles to authorize transactions providing additional security and flexibility for your smart contracts. They are handled implicitly by Marlowe Runtime. | ||
|
||
Each participant in a Marlowe contract has a role and each role has its own token. These tokens can be transferred between users in a peer-to-peer manner, allowing a participant to give their role to someone else. | ||
|
||
There could be one or many tokens for a specific role. | ||
|
||
Role tokens are distributed at contract initialization. | ||
|
||
Participants who want to make a transaction include their role token as input. The token doesn’t stay with the script or go anywhere else; it simply passes through the script and returns to the participant, allowing them to authorize another transaction. | ||
|
||
When designating an address after launching the contract, the open roles feature is used. | ||
|
||
## Open roles | ||
|
||
'Open roles' allows for the specification of an address after contract deployment that is not known at deployment time. | ||
|
||
When using open roles, the Marlowe contract sends the role tokens to a validator script that holds them until you specify an address later, at which time they are sent to the appropriate address. | ||
|
||
This feature is best used when a developer is deploying a smart contract where certain addresses are unknown. It could be one address or all addresses associated with a contract. | ||
|
||
The developer would deploy a contract that could be verified on-chain before a user interacts with it. The user initiates some action, like a deposit or choice, which triggers the smart contract to assign them the appropriate role and distribute the role token from the validator script. | ||
|
||
The developer just needs to specify the `OpenRoles` type when setting participants in a contract, the rest is handled behind the scenes by Marlowe Runtime. | ||
|
||
Because we have now introduced a separate validator script to help with our smart contract, we need to assign a 'thread token.' | ||
|
||
### Thread tokens | ||
|
||
Much like a role token is tied to a participant, a thread token is tied to a contract instance. | ||
|
||
Thread tokens are required for the validator script to be able to determine which 'thread' of role tokens to track, where 'threads' are instances of a contract. Without it, the script would not know which contract to apply the role tokens to. |
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
dd22574
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Deploy preview for marlowe-doc ready!
✅ Preview
https://marlowe-ijtctykno-iog.vercel.app
https://docs.marlowe.iohk.io
https://marlowe-doc.vercel.app
Built with commit dd22574.
This pull request is being automatically deployed with vercel-action