This PR will make exchange rate canister the first "pullable" mainnet canister.
Click Me: What does "pullable" mean?
Once the exchange rate canister is deployed, any app canister integrating with the exchange rate canister will only need specify its dependency in `dfx.json` as:
```json
{
"canisters": {
"app": {
"type": "motoko",
"main": "src/main.mo",
"dependencies": [
"exchange-rate"
]
},
"exchange-rate": {
"type": "pull",
"id": "uf6dk-hyaaa-aaaaq-qaaaq-cai"
}
}
```
Then they can pull the dependency from the mainnet and deploy it locally:
```sh
dfx deps pull # fetch the metadata and download the wasm
dfx deps init # setup init arguments (exchange rate canister needs no argument)
dfx deps deploy # deploy on the local replica with the same canister ID as mainnet
```
Check this [page](https://github.com/dfinity/sdk/blob/master/docs/concepts/pull-dependencies.md) for an instruction of "pull dependencies".
Changes
The major change in this PR is in the dfx.json. It adds the necessary metadata in the "pullable" field.
Also dfx handles the wasm optimization and gzip during canister building.
Next Step
One important thing to make the canister "pullable" is serving the wasm module through an URL as the wasm_url field in dfx.json.
This PR will make exchange rate canister the first "pullable" mainnet canister.
Click Me: What does "pullable" mean?
Once the exchange rate canister is deployed, any app canister integrating with the exchange rate canister will only need specify its dependency in `dfx.json` as: ```json { "canisters": { "app": { "type": "motoko", "main": "src/main.mo", "dependencies": [ "exchange-rate" ] }, "exchange-rate": { "type": "pull", "id": "uf6dk-hyaaa-aaaaq-qaaaq-cai" } } ``` Then they can pull the dependency from the mainnet and deploy it locally: ```sh dfx deps pull # fetch the metadata and download the wasm dfx deps init # setup init arguments (exchange rate canister needs no argument) dfx deps deploy # deploy on the local replica with the same canister ID as mainnet ``` Check this [page](https://github.com/dfinity/sdk/blob/master/docs/concepts/pull-dependencies.md) for an instruction of "pull dependencies".Changes
The major change in this PR is in the
dfx.json
. It adds the necessary metadata in the "pullable" field.Also
dfx
handles the wasm optimization and gzip during canister building.Next Step
One important thing to make the canister "pullable" is serving the wasm module through an URL as the
wasm_url
field indfx.json
.I entered "https://github.com/dfinity/exchange-rate-canister/releases/latest/download/xrc.wasm.gz" which doesn't exist yet.
In this way, we will use GitHub Releases to host the wasm. The workflow would be:
A common practice is creating a GItHub Action workflow triggered by git tag.