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.
We already have a function to fetch the current ICP exchange rate. We want to call this periodically to have a reasonably up-to-date exchange rate.
Given that the total_locked_e8s exposed by the governance canister only updates once a day, updating the exchange rate 4 times a day, seems often enough.
Changes
Add init_exchange_rate_timers to set up both a 1-time timer (for a quick initial value) and an interval timer.
Update the golden exports files as the use of the timer caused the canister exports to change.
Tests
Added a unit test that verifies the timers are set up and do the right thing when called.
Tested manually in a more fully developed branch.
Todos
[ ] Add entry to changelog (if necessary).
not yet
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.
We already have a function to fetch the current ICP exchange rate. We want to call this periodically to have a reasonably up-to-date exchange rate.
Given that the
total_locked_e8s
exposed by the governance canister only updates once a day, updating the exchange rate 4 times a day, seems often enough.Changes
init_exchange_rate_timers
to set up both a 1-time timer (for a quick initial value) and an interval timer.Tests
Todos