Skip to content

zenGate-Global/oracle-consumer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

oracle-consumer

This is an example implementation of a contract which consumes merkle oracle data.

  • The oracle box is validated by checking that the singleton asset is present in the box
  • The merkle trie is built by extracting the merkle root from the oracle box's datum
  • The keyHash, raw value, and membership proof are extracted from the redeemer which is done by the transaction builder
  • the contract hashes the raw value then checks that it is present in the merkle trie by using the keyHash and membership proof

After these checks, any business logic can be done as the data in the redeemer is now validated.

In this example, the business logic is to check that the value is greater than a threshold. If it is, the transaction builder can withdraw assets from this (self) utxo.

Building

aiken build

Configuring

aiken.toml

[config.default]
network_id = 41

Or, alternatively, write conditional environment modules under env.

Testing

You can write tests in any module using the test keyword. For example:

use config

test foo() {
  config.network_id + 1 == 42
}

To run all tests, simply do:

aiken check

To run only tests matching the string foo, do:

aiken check -m foo

Documentation

If you're writing a library, you might want to generate an HTML documentation for it.

Use:

aiken docs

Resources

Find more on the Aiken's user manual.

About

Example smart contract, written in aiken, demonstrating how to leverage merkle oracle

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages