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.
There are 2 inputs to this data:
The amount of ICP locked in neurons
The price of ICP in USD.
We already have functions which periodically fetch this data and store it in the canister state.
This PR adds a function to get the TVL calculated from these 2 inputs.
Changes
Add get_tvl which returns the current TVL. The return type is the way it is to make it compatible with the existing TVL canister. This allows us to migrate the frontend from using the TVL canister to getting the same data from the nns-dapp canister without changing frontend code.
Tests
Unit test added.
Tested manually in another branch which has more changes.
Will add an integration test when the feature is ready.
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.
There are 2 inputs to this data:
We already have functions which periodically fetch this data and store it in the canister state.
This PR adds a function to get the TVL calculated from these 2 inputs.
Changes
Add
get_tvl
which returns the current TVL. The return type is the way it is to make it compatible with the existing TVL canister. This allows us to migrate the frontend from using the TVL canister to getting the same data from the nns-dapp canister without changing frontend code.Tests
Todos