-
Notifications
You must be signed in to change notification settings - Fork 28
Threshold lib updates #299
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
This service is a wrappe for the VendingMachine contract in the Threshold network. It implements an interface of update protocol to enable KEEP/NU token holders to wrap their tokens and obtain T tokens according to a fixed ratio.
Add a function that fetches the all stakes for a given owner address.
Preview uploaded to https://preview.dashboard.test.threshold.network/threshold-lib-updates/index.html. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking good! Left some small comments
Preview uploaded to https://preview.dashboard.test.threshold.network/threshold-lib-updates/index.html. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
This PR moves the contract integration part from hooks to the Threshold-ts library. Thanks to this layer we can separate work between UI and contract integration. Also, it helps to unit test created services and move the "business logic" from the React hooks.
Main changes in Threshold-ts lib
Vending Machine
An interface of the wrapper for fetching on-chain data from the
VendingMachine
contract- the interface of update protocol to enable KEEP/NU token holders to wrap their tokens and obtain T tokens according to a fixed ratio. The Threshold lib creates a separate instance of the vending machine for KEEP holders and a separate instance of the vending machine for NU holders. Service covered with unit tests.Staking
Adds function
getOwnerStakes
that fetches all stakes for a given owner address. Here we add legacy Keep and Nu staking contracts as private fields to theStaking
service to calculate possible KEEP/NU top-up in T. Also pass Keep and Nu vending machines to convert KEEP/NU amount to T.Utils functions
Move some contract-related utils functions from dashboard to the Threshold-ts lib.