-
Notifications
You must be signed in to change notification settings - Fork 134
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
docs(lockup-contract): refactored README for better clarity #144
Conversation
I also created additional doc with cute pictures: https://github.com/telezhnaya/docs/blob/master/docs/tokens/lockup_vesting_details.md |
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.
Overall, looks accurate to me. Once we have the visualizations, it will be perfect
BTW, I suggest using https://grammarly.com/ to check the grammar 😉 |
lockup/README.md
Outdated
The contract can contain a vesting schedule and serve as a vesting agreement between the Contract Creator and an employee (owner of the contract). | ||
|
||
Contract Creator is either the NEAR Foundation, or it could be a third-party account. | ||
It is set at the moment of initializing the contract by the `foundation_account_id` field (naming could be confusing). |
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.
Please explain why it was named like that.
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.
Maybe it's better to delete the information in braces at all?
The explanation is boring. I didn't ask @evgenykuzyakov but I guess, at first, we just didn't think about using other creators apart of NEAR Foundation. Then, after that, the ability to set it was added, but naming was left as it is.
@evgenykuzyakov please correct me if I am wrong.
lockup/README.md
Outdated
|
||
### Early Vesting Termination | ||
|
||
In case of vesting schedule, the contract supports the ability for the NEAR Foundation to terminate vesting at any point before it completes. | ||
If the vesting is terminated before the cliff all tokens are refunded to the Foundation. Otherwise the remaining unvested tokens are refunded. | ||
In the case of vesting schedule, the contract supports the ability for the Contract Creator to terminate vesting at any point before it completes. |
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.
I thought it is foundation_account_id
that has control over the termination? Should we define what Contract Creator is?
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.
I thought it is foundation_account_id that has control over the termination?
Yes, that's true.
Should we define what Contract Creator is?
It was defined earlier, in the same paragraph with foundation_account_id
.
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.
I believe the confusion here is that "Contract Creator" is ambiguous since on mainnet it is lockup-factory which creates and deploys the contract. My suggestion would be to rename it to "foundation" (without "NEAR" and lowercase) implying any foundation which might be interested in founding lockup contracts and thus become the entity ensuring the trust to terminate vesting early. Our error messages in the contract return messages like:
"Foundation account should be added for vesting schedule"
"Foundation account can't be added without vesting schedule"
"Can only be called by NEAR Foundation"
(the last one is unfortunately too specific)
lockup/README.md
Outdated
|
||
In the event of termination, the vesting stops and the remaining unvested tokens are locked until they are withdrawn by the Foundation. | ||
In the event of termination, the vesting stops, and the remaining unvested tokens are locked until they are withdrawn by the Contract Creator. |
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.
This seems like a more detailed explanation of "If the vesting is terminated before the cliff all tokens are refunded to the Contract Creator. Otherwise, the remaining unvested tokens are refunded.", should we make it a bullet list and pre-phase it with "More specifically:"?
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.
I can change it but I try to be not too wordy. I think that my wording gives the same amount of information, doesn't it?
lockup/README.md
Outdated
During termination, the owner can't issue any action towards the staking pool or issue transfers. | ||
If the amount of tokens on the contract account is less than the remaining unvested balance, the Foundation will try to unstake and withdraw everything from the staking pool. | ||
Once the tokens are withdrawn from the staking pool, the Foundation will proceed with withdrawing the unvested balance from the contract. | ||
If the amount of tokens on the contract account is less than the remaining unvested balance, the Contract Creator will try to unstake and withdraw everything from the staking pool. |
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.
How can this be possible, if tokens are transferrable from this contract only when they are vested?
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 is possible if tokens are on the staking pool
lockup/README.md
Outdated
|
||
If there is still a termination balance deficit due to minimum required balance, the owner may decide to fund the deficit on this account to finish the termination process. | ||
This can be done through a regular transfer action from an account with liquid balance. | ||
If there is still a termination balance deficit due to the minimum required balance, the owner may decide to fund the deficit on this account to finish the termination process. |
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.
This sounds like an important mechanism that everyone should be aware of. Is it possible to pre-fund all lockup contracts upon creation with 35 extra NEAR to avoid having this situation upon termination?
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.
I think we can talk with our financiers and ask them to transfer additional 35 NEAR to the account.
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.
nit: given that we lowered storage costs 10x, 3.5NEAR should be enough
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.
- If the NEAR Foundation account ID is provided during initialization, the NEAR Foundation can terminate vesting schedule. | ||
- If the NEAR Foundation account ID is not provided, the vesting schedule can't be terminated. | ||
- Lock tokens for the lockup period with the release duration. Tokens are linearly released on transfers are enabled. | ||
Since the vesting schedule usually starts at the date of employment it allows to de-anonymize the owner of the lockup contract. |
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.
To clarify, this contract will be used not just for the employees.
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.
Yes, I know. As I understand, private vesting was used only for Near employees and we don't have plans to use it anymore.
lockup/README.md
Outdated
|
||
### Early Vesting Termination | ||
|
||
In case of vesting schedule, the contract supports the ability for the NEAR Foundation to terminate vesting at any point before it completes. | ||
If the vesting is terminated before the cliff all tokens are refunded to the Foundation. Otherwise the remaining unvested tokens are refunded. | ||
In the case of vesting schedule, the contract supports the ability for the Contract Creator to terminate vesting at any point before it completes. |
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.
I believe the confusion here is that "Contract Creator" is ambiguous since on mainnet it is lockup-factory which creates and deploys the contract. My suggestion would be to rename it to "foundation" (without "NEAR" and lowercase) implying any foundation which might be interested in founding lockup contracts and thus become the entity ensuring the trust to terminate vesting early. Our error messages in the contract return messages like:
"Foundation account should be added for vesting schedule"
"Foundation account can't be added without vesting schedule"
"Can only be called by NEAR Foundation"
(the last one is unfortunately too specific)
Some changes were done. I cleaned up the history of commits, I also deleted changes from the code (I fixed some comments there, me and @frol decided not to touch the source code in this PR). The first commit is the original version + corrections after all reviews. In the second commit, I re-ordered things a little and marked |
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.
With this change and the change to the high-level overview in the NEAR docs (near/docs#691), I believe, we reached the following:
- Confirmed that the implementation itself is correct
- The descriptions that were too low-level (reference-like) were extended with more context and references to the high-level ideas
- The descriptions that were too generic (leading to uncertainty) were extended with specific examples and illustrations
@telezhnaya Thanks for the thorough review of all the information we had and driving this initiative forward!
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.
Thanks for the documentation fix, approving assuming the remaining comments are resolved.
The owner can choose the staking pool where to delegate tokens. | ||
The staking pool contract and the account has to be approved and whitelisted by the foundation, to prevent lockup tokens from being lost, locked or stolen. | ||
The owner can choose the staking pool for delegating tokens. | ||
The staking pool contract and the account have to be approved and whitelisted by the NEAR Foundation, to prevent lockup tokens from being lost, locked, or stolen. |
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 looks so. @evgenykuzyakov please confirm
Waiting for confirmation from @telezhnaya or @evgenykuzyakov
I am not sure but it looks like it's not possible to pass the address of the whitelisting contract
It would be good if we could figure it out from the contract code. If whitelisting contract is hardcoded, then it would be good to have a link to the code where it is defined.
This staking pool must be an approved account, which is validated by a whitelisting contract. | ||
Once the staking pool holds tokens, the owner of the staking pool is able to use them to vote on the network governance issues, such as enabling transfers. | ||
So it's important for the owner to pick the staking pool that fits the best. | ||
Once the staking pool holds tokens, the owner of the staking pool can use them to vote on the network governance issues, such as enabling transfers. |
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.
Is it hardcoded in the contract? Could we please link the place from the source code in the documentation?
I had to merge ASAP since it is good enough now, and I wanted to remove the scary banner and let partners review the contract without misleading messages. @telezhnaya please, submit a separate PR addressing the concerns from the comments |
What have been done:
technical details
section. All the info from it is outdated (first point) or written in corresponding sections.Resolves #140, resolves #141