dfinity / snsdemo

Developer focused SNS deployment demo
15 stars 6 forks source link

Install exchange rate canister #397

Closed dskloetd closed 4 weeks ago

dskloetd commented 4 weeks ago

Motivation

The NNS dapp displays the USD value of the total amount of ICP locked in neurons. It gets this information from the TVL canister but we want to move this functionality to the nns-dapp canister and remove the TVL canister.

To test the TVL, we need to be able to get an exchange rate from the exchange rate canister. To make this possible while testing, we install a mock exchange rate canister.

Changes

  1. Refactor bin/dfx-software-mock-bitcoin-install to extract bin/dfx-mock-canister-install for installing a generic mock canister.
  2. Add bin/dfx-mock-exchange-rate-canister-install using bin/dfx-mock-canister-install.
  3. Add bin/dfx-mock-exchange-rate-set to populate the exchange rate.
  4. Install the exchange rate canister and set an exchange rate for ICP/USD in bin/dfx-stock-deploy.

Tests

  1. Added bin/dfx-mock-exchange-rate-canister-install.test analogous to bin/dfx-software-mock-bitcoin-install.test and added it to .github/workflows/checks.yml.
  2. Created a snapshot and used it with a version of the nns-dapp that has TVL implemented.