Done in preperation to adding support for ERC20 tokens.
Previously currency parsers for different currencies where stored in
and fetched from a singleton instance of a map in the currency
package.
Using singleton instance works fine since only one type of currency
was used, but does not work well when many symbols (one for each ERC20
token) are to be registered when the node is running.
Because, the node will register the currency in currency registry and
the asset contract address in contract registry (to be done), it is
better to store these two registries in the node.
Hence, implemented a contract registry & added it as a field in the
node. Also, added a test helper package with a registry that has all
the required symbols pre-registered.
Also, moved the constant values of the channel struct in session
package to a new struct called params. It is easier to pass this field
rather than passing "parts", "currency", "id" etc., individually.
Category
Implementation Task
Relevant issue
Relates to #193.
Testing
Add tests for the newly added currency registry and updated existing tests.
Steps to run the tests
Checklist
[x] Name is added to the NOTICE file, if it is not present already.
Description
Done in preperation to adding support for ERC20 tokens.
Previously currency parsers for different currencies where stored in and fetched from a singleton instance of a map in the currency package.
Using singleton instance works fine since only one type of currency was used, but does not work well when many symbols (one for each ERC20 token) are to be registered when the node is running.
Because, the node will register the currency in currency registry and the asset contract address in contract registry (to be done), it is better to store these two registries in the node.
Hence, implemented a contract registry & added it as a field in the node. Also, added a test helper package with a registry that has all the required symbols pre-registered.
Also, moved the constant values of the channel struct in session package to a new struct called params. It is easier to pass this field rather than passing "parts", "currency", "id" etc., individually.
Category
Implementation Task
Relevant issue
Relates to #193.
Testing
Add tests for the newly added currency registry and updated existing tests.
Steps to run the tests
Checklist