-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: building basic skeleton for oracle validator
- Loading branch information
1 parent
9229aca
commit a8bc120
Showing
7 changed files
with
55 additions
and
7 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,4 +5,5 @@ build/ | |
# Aiken's default documentation export | ||
docs/ | ||
|
||
.vscode | ||
test.json |
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 |
---|---|---|
@@ -1,7 +1,6 @@ | ||
use aiken/cbor.{serialise} | ||
use aiken_content_ownership/placeholder.{mock_utxo_ref} | ||
|
||
test diag() { | ||
// serialise(mock_utxo_ref(0)) == #"d8799fd8799f58205a077cbcdffb88b104f292aacb9687ce93e2191e103a30a0cc5505c18b719f98ff00ff" | ||
serialise(mock_utxo_ref(1)) == #"d8799fd8799f58205a077cbcdffb88b104f292aacb9687ce93e2191e103a30a0cc5505c18b719f98ff01ff" | ||
} | ||
// use aiken/cbor.{serialise} | ||
// use aiken_content_ownership/placeholder.{mock_utxo_ref} | ||
// test diag() { | ||
// // serialise(mock_utxo_ref(0)) == #"d8799fd8799f58205a077cbcdffb88b104f292aacb9687ce93e2191e103a30a0cc5505c18b719f98ff00ff" | ||
// serialise(mock_utxo_ref(1)) == #"d8799fd8799f58205a077cbcdffb88b104f292aacb9687ce93e2191e103a30a0cc5505c18b719f98ff01ff" | ||
// } |
Empty file.
Empty file.
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,48 @@ | ||
use aiken/transaction.{ScriptContext, Spend} | ||
use aiken/transaction/credential.{Address, Credential} | ||
use aiken/transaction/value.{PolicyId} | ||
|
||
type Datum { | ||
content_registry_address: Address, | ||
content_registry_ref_token: PolicyId, | ||
ownership_registry_address: Address, | ||
ownership_registry_ref_token: PolicyId, | ||
content_registry_count: Int, | ||
ownership_registry_count: Int, | ||
operation_key: Credential, | ||
stop_key: Credential, | ||
} | ||
|
||
type Redeemer { | ||
CreateContentRegistry | ||
CreateOwnershipRegistry | ||
RotateKey { new_operation_key: Credential, new_stop_key: Credential } | ||
StopApp | ||
} | ||
|
||
validator { | ||
fn oracle_validator(datum: Datum, redeemer: Redeemer, context: ScriptContext) { | ||
let ScriptContext { purpose, transaction } = context | ||
when purpose is { | ||
Spend(_) -> | ||
when redeemer is { | ||
CreateContentRegistry -> | ||
// Ref token is minted to address | ||
// count + 1 | ||
True | ||
CreateOwnershipRegistry -> | ||
// Ref token is minted to address | ||
// count + 1 | ||
True | ||
RotateKey { new_operation_key, new_stop_key } -> | ||
// Sign by both ops and stop key | ||
// datum update correctly (key rotated) | ||
True | ||
StopApp -> | ||
// signed by stop key | ||
True | ||
} | ||
_ -> False | ||
} | ||
} | ||
} |
Empty file.
Empty file.