clp-feed-interface
Interface package for querying the Coreum Lending Protocol (CLP) Feed oracle contract. This package provides type-safe bindings for interacting with the CLP Feed price oracle, which aggregates validator-signed price data for various assets.
Installation
Add this to your Cargo.toml:
[]
= "0.1.0"
= "2.2"
Quick Start
Using the Helper Querier (Recommended)
use ;
use ClpFeedQuerier;
// In your contract's execute or query function
Direct Query
use ;
use ;
Available Queries
Price Queries
GetPrice
Get the current aggregated price for an asset by name.
use QueryMsg;
let query = GetPrice ;
GetPriceByDenom
Get the current aggregated price for a denom (e.g., "uatom").
let query = GetPriceByDenom ;
GetAllPrices
Get all current aggregated prices.
let query = GetAllPrices ;
Validator Queries
GetValidator
Get information about a specific validator.
let query = GetValidator ;
GetAllValidators
Get all registered validators.
let query = GetAllValidators ;
Configuration Queries
GetConfig
Get contract configuration (min signatures, max price age).
let query = GetConfig ;
GetAdmin
Get the admin address.
let query = GetAdmin ;
GetOperators
Get all operator addresses.
let query = GetOperators ;
GetDenomExists
Check if a denom is configured.
let query = GetDenomExists ;
GetRecentSubmission
Get a recent price submission from a specific validator.
let query = GetRecentSubmission ;
Type Definitions
AggregatedPrice
The main price data structure returned by the oracle:
PriceSubmission
Individual validator price submission:
ValidatorInfo
Validator information:
Complete Example
use ;
use ;
Response Types
All query responses are strongly typed:
AggregatedPriceResponse- ContainsOption<AggregatedPrice>AllPricesResponse- ContainsVec<AggregatedPrice>ValidatorInfoResponse- Contains validator ID andOption<ValidatorInfo>AllValidatorsResponse- ContainsVec<(String, ValidatorInfo)>PriceSubmissionResponse- ContainsOption<PriceSubmission>ConfigResponse- Containsmin_signatures: u32andmax_price_age: u64AdminResponse- Containsadmin: AddrOperatorsResponse- Containsoperators: Vec<Addr>DenomExistsResponse- Containsexists: boolandasset: Option<AssetInfo>
Deployed Contracts
Mainnet
- Contract Address:
TBD(Update after deployment)
Testnet
- Contract Address:
TBD(Update after deployment)
Version Compatibility
| clp-feed-interface | clp-feed Contract | Status |
|---|---|---|
| 0.1.0 | 0.1.0 | ✅ Compatible |
Features
- ✅ Type-safe - Full Rust type definitions for all queries and responses
- ✅ Lightweight - Minimal dependencies (only CosmWasm standard libraries)
- ✅ Helper functions - Convenient
ClpFeedQuerierwrapper - ✅ Well-documented - Comprehensive inline documentation
- ✅ Schema support - Compatible with CosmWasm schema generation
Error Handling
The oracle may return None for prices in certain cases:
- Asset/denom not configured
- No price data available yet
- Price data expired
Always check for None values:
let response = oracle.query_price_by_denom?;
match response.price
License
MIT