-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #7 from Rigidity/more-utilities-examples
Add more stdlib and examples
- Loading branch information
Showing
8 changed files
with
123 additions
and
10 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
// This puzzle has not been audited or tested, and is for example purposes only. | ||
|
||
fun main(public_key: PublicKey, conditions: Condition[]) -> Condition[] { | ||
let agg_sig = Condition::AggSigMe { | ||
public_key: public_key, | ||
message: tree_hash(conditions), | ||
}; | ||
[agg_sig, ...conditions] | ||
} |
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,25 @@ | ||
// This puzzle has not been audited or tested, and is for example purposes only. | ||
|
||
fun main( | ||
synthetic_pk: PublicKey, | ||
original_pk: PublicKey?, | ||
delegated_puzzle: fun(...Any) -> Condition[], | ||
delegated_solution: Any | ||
) -> Condition[] { | ||
let conditions = delegated_puzzle(...delegated_solution); | ||
let delegated_puzzle_hash = tree_hash(delegated_puzzle); | ||
|
||
if original_pk != nil { | ||
let exponent = sha256(original_pk as Bytes + delegated_puzzle_hash); | ||
let offset_pk = pubkey_for_exp(exponent); | ||
assert synthetic_pk == original_pk + offset_pk; | ||
return conditions; | ||
} | ||
|
||
let agg_sig_me = Condition::AggSigMe { | ||
public_key: synthetic_pk, | ||
message: delegated_puzzle_hash, | ||
}; | ||
|
||
[agg_sig_me, ...conditions] | ||
} |
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 @@ | ||
2a |
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