-
Notifications
You must be signed in to change notification settings - Fork 589
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
Lockup module #22
Lockup module #22
Conversation
Generally, I think this is good. However, one thing we should consider is to prevent users accidentally locking their tokens for a wrong length. For example, the ‘yield’ module may only support 3, 6, 9 month lockup periods. But if the user happens to accidentally send a transaction for a 4-month locking period they will have to wait 4 months to be able to do anything with their token while not receiving rewards. As this is the user’s own fault, it may not be a crucial consideration for launch but is worth considering. Imho, I think the lockup module could avoid using hooks and not have any messages, and rather use a way where it works from the other module’s keepers. So the other module’s keeper can lock and unlock token from the lockup keeper? |
2499890
to
e3f9dc0
Compare
I think this would be better to handle at the UI level, don't need to unnecessarily restrict lockup times in the state machine, because there might be use cases we might not have thought of yet. For example, another project might want to have liquidity mining for their own pools, based on times that aren't used by the base yield module. Maybe I just want to reward people for providing 1 week liquidity locks for my token :) Also, another use case for this module I was thinking of is validators to lockup their staking derivatives to give guarantees to their delegators. Because if staking automatically creates staking derivatives for example, validators may want to lockup their derivatives to show delegators that they are long term locked and invested.
This seems like an interesting design pattern. But I'm worried this comes back to restricting "un-thought of" use cases. Someone might come up with a use case for the lockup module that's unrelated to any existing module on the chain. (For example, the lockdrops done by Edgeware). Oh also, for our use case, can't locking up tokens have multiple uses? For example, I could be locking some LP tokens to vote in my LP pool governance, but also for yield farming. Which module's lockMsg should I be using? I'd still need hooks regardless. |
…kTokens function into keeper
… or 1h instead of integer in milliseconds
…s prefix of other denom
…_query and msg_server to latest
…dify unlock individual event
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.
Most of the the code looks good, but I had a couple questions on the following points. Could you take a look @antstalepresh?
} | ||
|
||
// DeleteLockRefByKey remove lock ID from an array associated to provided key | ||
func (k Keeper) DeleteLockRefByKey(ctx sdk.Context, key []byte, lockID uint64) { |
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.
Should these be public functions?
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.
It's used within test
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.
Oh I didn't realize tests in the same package, couldn’t access private functions. Is there another way to deal with this, because otherwise it breaks the point of separating AdminKeeper from normal.
No description provided.