Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/switchboard-xyz/evm-sdk

Switchboard V2 SDK for EVM chains
https://github.com/switchboard-xyz/evm-sdk

blockchain dapp ethereum ipfs web3

Last synced: 7 days ago
JSON representation

Switchboard V2 SDK for EVM chains

Awesome Lists containing this project

README

        

![Switchboard Logo](https://github.com/switchboard-xyz/sbv2-core/raw/main/website/static/img/icons/switchboard/avatar.png)

# Switchboard x EVM

> A collection of libraries and examples for interacting with Switchboard on EVM
> chains.

[![NPM Badge](https://img.shields.io/github/package-json/v/switchboard-xyz/sbv2-evm?color=red&filename=javascript%2Fevm.js%2Fpackage.json&label=%40switchboard-xyz%2Fevm.js&logo=npm)](https://www.npmjs.com/package/@switchboard-xyz/evm.js)

## Getting Started

To get started, clone the
[evm-sdk](https://github.com/switchboard-xyz/evm-sdk) repository.

```bash
git clone https://github.com/switchboard-xyz/evm-sdk
```

Then install the dependencies

```bash
cd evm-sdk
pnpm install
pnpm build
```

## Switchboard Functions

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](https://github.com/switchboard-xyz/evm-functions-template).

## Switchboard Feeds

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](https://github.com/switchboard-xyz/evm-functions-template/tree/main/rust/01_price_oracle/SwitchboardPushReceiver).
- [Receiver.sol](https://github.com/switchboard-xyz/evm-functions-template/blob/main/rust/01_price_oracle/SwitchboardPushReceiver/contracts/src/SwitchboardPushReceiver/Receiver/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](https://github.com/switchboard-xyz/evm-functions-template/blob/main/rust/01_price_oracle/SwitchboardPushReceiver/switchboard-function/src/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](https://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

## Clients

| **Lang** | **Name** | **Description** |
| ---------- | -------------------------------------------- | --------------------------------------------------------------------------------- |
| Solidity | [ISwitchboard](solidity/ISwitchboard) | A Solidity contract to read a Switchboard data feed. |
| Solidity | [ILegacyOracle](solidity/ILegacyOracle) | A Solidity contract to read a Switchboard data feed with a legacy oracle adapter. |
| Javascript | [@switchboard-xyz/evm.js](javascript/evm.js) | A Typescript client to interact with Switchboard on EVM chains. |

## Example Contracts

| **Lang** | **Name** | **Description** |
| -------- | -------------------------------------------------------------- | -------------------------------------------------------------------------------------------- |
| Solidity | [randomness-calllback](examples/01_randomness_callback) | An example Solidity contract demonstrating how to consume randomenss with Switchboard. |
| Solidity | [user-triggered-callback](examples/02_user_triggered_callback) | An example Solidity contract demonstrating how manually trigger a callback with Switchboard. |

## Troubleshooting

1. File a [GitHub Issue](https://github.com/switchboard-xyz/evm-sdk/issues/new)
2. Ask a question in
[Discord #dev-support](https://discord.com/channels/841525135311634443/984343400377647144)