Skip to content
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

Merged
merged 37 commits into from
Feb 10, 2021
Merged

Lockup module #22

merged 37 commits into from
Feb 10, 2021

Conversation

antstalepresh
Copy link
Contributor

No description provided.

x/lockup/spec/02_state.md Outdated Show resolved Hide resolved
x/lockup/spec/02_state.md Outdated Show resolved Hide resolved
x/lockup/spec/02_state.md Outdated Show resolved Hide resolved
x/lockup/spec/02_state.md Outdated Show resolved Hide resolved
x/lockup/spec/06_hooks.md Outdated Show resolved Hide resolved
x/lockup/spec/04_events.md Outdated Show resolved Hide resolved
@Thunnini
Copy link
Collaborator

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?

@sunnya97
Copy link
Collaborator

@Thunnini

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...

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.

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?

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.

@antstalepresh antstalepresh changed the title Lockup module - WIP Lockup module Feb 4, 2021
Copy link
Collaborator

@Thunnini Thunnini left a 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?

x/lockup/keeper/admin_keeper.go Outdated Show resolved Hide resolved
x/lockup/keeper/lock.go Show resolved Hide resolved
@sunnya97 sunnya97 requested a review from mconcat February 9, 2021 09:23
}

// DeleteLockRefByKey remove lock ID from an array associated to provided key
func (k Keeper) DeleteLockRefByKey(ctx sdk.Context, key []byte, lockID uint64) {
Copy link
Collaborator

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?

Copy link
Contributor Author

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

Copy link
Collaborator

@sunnya97 sunnya97 Feb 10, 2021

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants