https://github.com/dfinity/exchange-rate-canister
The exchange rate canister (XRC) makes use of the HTTP requests feature to provide exchange rates as a service to the IC.
https://github.com/dfinity/exchange-rate-canister
Last synced: 2 months ago
JSON representation
The exchange rate canister (XRC) makes use of the HTTP requests feature to provide exchange rates as a service to the IC.
- Host: GitHub
- URL: https://github.com/dfinity/exchange-rate-canister
- Owner: dfinity
- License: apache-2.0
- Created: 2022-08-16T20:02:51.000Z (about 3 years ago)
- Default Branch: main
- Last Pushed: 2024-09-05T14:07:19.000Z (about 1 year ago)
- Last Synced: 2024-10-05T16:10:37.408Z (about 1 year ago)
- Language: Rust
- Size: 33.7 MB
- Stars: 37
- Watchers: 22
- Forks: 10
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
- Codeowners: .github/CODEOWNERS
Awesome Lists containing this project
- awesome-internet-computer - Exchange Rate Canister - Oracle service for cryptocurrency and fiat currency exchange rates. (Decentralized Finance (DeFi) / Oracles)
README
# Exchange Rate Canister
## Overview
The exchange rate canister provides an oracle service for cryptocurrency and
fiat currency exchange rates.
It interacts with all data sources using the
[HTTPS outcalls](https://internetcomputer.org/https-outcalls/) feature.
## Usage
The exchange rate canister offers a single endpoint:
```
"get_exchange_rate": (GetExchangeRateRequest) -> (GetExchangeRateResult)
```
The request must specify the base and quote assets and, optionally, a UNIX timestamp in seconds.
The returned result contains either the exchange rate for the requested asset pair
along with some metadata or an error.
Details can be found in the [interface specification](INTERFACE_SPECIFICATION.md) and in the [developer documentation](https://internetcomputer.org/docs/references/system-canisters/xrc/).
> **_NOTE:_** 1B cycles must be sent to the exchange rate canister with each request.
A certain amount may be refunded depending on the number of required HTTPs outcalls
to serve the request. The base fee is 20M cycles.
## Official build
The official build should ideally be reproducible, so that independent parties
can validate that the correct WebAssembly module was deployed.
A dockerized build environment is used to build the gzipped WebAssembly module and
print its SHA-256 hash.
```bash
export IP_SUPPORT=ipv4
./scripts/docker-build
sha256sum xrc.wasm.gz
```
The canister ID of the deployed exchange rate canister is `uf6dk-hyaaa-aaaaq-qaaaq-cai`.
## Contribution mode
External contributions are accepted.