Building with Connect? Join our Discord!
x/oracle and x/marketmap modules.
Adding Connect SDK To Your Contract
The version of the Connect SDK for your contract depends on the Connect protocol version of the chain.| Connect Protocol Version | Connect SDK Version |
|---|---|
| v1.x | v0.1.0 |
| v2.x | v0.2.0 |
How to find the Connect Protocol versionThe protocol version of Connect can be found on the chain by either:
- Checking the chain’s
go.modfile. - Checking the required version in the quickstart
dependencies section of your Cargo.toml:
connect-sdk = { git = "https://github.com/skip-mev/connect-sdk", tag = "CONNECT SDK VERSION HERE", package = "connect-sdk" }
Safely Accessing Price Data
The following checks should be made before utilizing a price from Connect in a contract:- currency-pair exists within the
x/oracleandx/marketmapmodules. - currency-pair is
enabledwithin thex/marketmap. - price
block_heightis not older than a few blocks. - price nonce is not 0.
Code Example
This code example is forv0.1.0 of the Connect SDK.
contract.rs