A collection of libraries and examples for interacting with Switchboard on EVM chains.
To get started, clone the evm-sdk repository.
git clone https://github.com/switchboard-xyz/evm-sdk
Then install the dependencies
cd evm-sdk
pnpm install
pnpm build
Switchboard V3 revolves around the concept of a Switchboard Function
. Functions are the core building block of Switchboard. They are the unit of work that is performed by the Switchboard network. Functions can be user defined, and can be composed together to create more complex functions. Function calls can be initialized on-chain, or on a schedule.
Get started writing Switchboard Functions with our functions template repository.
Switchboard Data Feeds are powered by Switchboard Functions. You can find the source code (contracts and off-chain logic) for the Switchboard Function that powers the available feeds in the functions repository.
- Receiver.sol) - The main entry point for the Switchboard Feed Function. This contract is deployed by the Switchboard, and is responsible for receiving data from the off-chain Switchboard Function, and making it available to other contracts.
- Main.rs - The off-chain Switchboard Function that powers the Switchboard Feed. This function is responsible for fetching data from an external API, and submitting it to the Switchboard Receiver contract.
You can find existing Switchboard Feeds and their ID's for accessing in solidity at app.switchboard.xyz.
You can use this simple price function (which supplies 500+ feeds from top exchanges!) and build custom functionality on top of it
Lang | Name | Description |
---|---|---|
Solidity | ISwitchboard | A Solidity contract to read a Switchboard data feed. |
Solidity | ILegacyOracle | A Solidity contract to read a Switchboard data feed with a legacy oracle adapter. |
Javascript | @switchboard-xyz/evm.js | A Typescript client to interact with Switchboard on EVM chains. |
Lang | Name | Description |
---|---|---|
Solidity | randomness-calllback | An example Solidity contract demonstrating how to consume randomenss with Switchboard. |
Solidity | user-triggered-callback | An example Solidity contract demonstrating how manually trigger a callback with Switchboard. |
- File a GitHub Issue
- Ask a question in Discord #dev-support