SEP-0040 Oracle
Exposes the interface of the SEP-0040 Price Feed Oracle alongside a test price oracle contract.
SEP-0040 Definition: https://github.com/stellar/stellar-protocol/blob/master/ecosystem/sep-0040.md
Safety
This is experimental software and is provided on an "as is" and "as available" basis.
We do not give any warranties and will not be liable for any loss incurred through any use of this codebase.
Getting Started
Add the package to your Cargo.toml
:
[]
= "<desired version>"
You can optionally include the testutils
feature in your dev-dependencies
to deploy a mock version of the sep-40-oracle
for testing:
[]
= { = "<desired version>", = ["testutils"] }
Client and Trait
This package exposes a client for interacting with SEP-0040 Oracles and a trait for contracts wishing to implement a SEP-0040 Oracle.
Client usage:
use PriceFeedClient;
let address = // address of the oracle
let price_feed_client = new;
Trait usage:
use PriceFeedTrait;
use ;
;
Mock PriceFeed Oracle
This package exposes an example Soroban price feed oracle implementation. This is useful for testing protocols that depend on a sep-0040
price feed oracle, including the ability to manipulate price feeds during a test.
A WASM version of the contract can be deployed as follows:
use ;
use ;
let env = default;
let admin = generate;
let xlm = generate;
let oracle_id = env.register_contract_wasm;
let oracle_client = new;
oracle_client.set_data;