-
Notifications
You must be signed in to change notification settings - Fork 4.4k
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
Add Vest program #5987
Add Vest program #5987
Conversation
@rob-solana, something like this (note: very WIP!) is what I'm thinking should be in the genesis block. As a separate requirement, we can pair Vest accounts with Budget accounts that are frozen until a given date. |
this won't support staking unvested tokens? |
@rob-solana, I'm open to adding that support. Have you already thought through how to do it? |
let mut dt = None; | ||
let mut days_back = 0; | ||
while dt.is_none() { | ||
dt = Utc |
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.
you can't use DTC in programs, wallclocks differ box-to-box
in other places where time passes, we use sysvar::clock... specify times in Slots
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.
The date comes from a trusted account, not from validators.
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.
you're supposed to compare the witness with the oracle? why not vest in terms of slots?
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'm worried someone will speed up the clock
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.
yeah, but would that be that bad? I guess there's also the problem of setting the vesting schedule based on some target mainnet launch instant...
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.
@aeyakovenko, thoughts on a date oracle versus cluster time?
it's kinda there in the stake program. in reading your description here, I realized there are some missing bits stakes are initialized with the purpose of the custodian is to allow the stake owner to return the tokens to someone who does KYC I don't have a way to withdraw back to a company, but this could maybe be handled by solving this: #5988 |
@rob-solana, we can setup the Vest accounts to pay lamports into Stake accounts. |
3ae62ff
to
b797575
Compare
Codecov Report
@@ Coverage Diff @@
## master #5987 +/- ##
========================================
+ Coverage 77.4% 77.7% +0.2%
========================================
Files 209 214 +5
Lines 39982 40476 +494
========================================
+ Hits 30953 31450 +497
+ Misses 9029 9026 -3 |
one thing about putting vesting in stakes via Stake::lockup is that the tokens can be active on the network, I'm not sure if that's the right thing, though |
Don't pretend I do trace debugging.
Only use DateTime where we require serde instances.
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.
Functionality lgtm
r+ a couple comment nits
Also made a couple variable suggestions, take 'em or leave 'em
Pull request has been modified.
Problem
Using Budget to manage vesting schedules is a pain. We need to create 25 Budget contracts per vesting schedule (which there may be multiple per person) and then have the maintainer to send ApplyTimestamp to each of those contracts to get them to distribute tokens.
Summary of Changes
Add a new program Vest that manages a full vesting schedule. After creation, the creator should only interact with a specific contract in order to terminate it. Otherwise, it should simply publish dates to a single trusted account, an oracle account. To redeem tokens, the payee should send a RedeemTokens instruction to the vesting account, which would include the address of the oracle account.
Fixes #5978