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

Add Vest program #5987

Merged
merged 17 commits into from Oct 4, 2019

Conversation

@garious
Copy link
Member

garious commented Sep 19, 2019

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.

  • Finish Vest program
  • Debate adding a DateTime program or tossing a DateTime account type into Vest
  • More branch coverage
  • Upload fun image

image

Fixes #5978

@garious

This comment has been minimized.

Copy link
Member Author

garious commented Sep 19, 2019

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

@rob-solana

This comment has been minimized.

Copy link
Contributor

rob-solana commented Sep 19, 2019

this won't support staking unvested tokens?

@garious

This comment has been minimized.

Copy link
Member Author

garious commented Sep 19, 2019

@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

This comment has been minimized.

Copy link
@rob-solana

rob-solana Sep 19, 2019

Contributor

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

This comment has been minimized.

Copy link
@garious

garious Sep 20, 2019

Author Member

The date comes from a trusted account, not from validators.

This comment has been minimized.

Copy link
@rob-solana

rob-solana Sep 25, 2019

Contributor

you're supposed to compare the witness with the oracle? why not vest in terms of slots?

This comment has been minimized.

Copy link
@garious

garious Sep 25, 2019

Author Member

I'm worried someone will speed up the clock

This comment has been minimized.

Copy link
@rob-solana

rob-solana Sep 25, 2019

Contributor

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

This comment has been minimized.

Copy link
@garious

garious Oct 3, 2019

Author Member

@aeyakovenko, thoughts on a date oracle versus cluster time?

@rob-solana

This comment has been minimized.

Copy link
Contributor

rob-solana commented Sep 19, 2019

@rob-solana, I'm open to adding that support. Have you already thought through how to do it?

it's kinda there in the stake program. in reading your description here, I realized there are some missing bits

stakes are initialized with lockup and custodian, a slot at which the tokens would be available for withdrawal, unless to the custodian

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

@garious

This comment has been minimized.

Copy link
Member Author

garious commented Sep 19, 2019

@rob-solana, we can setup the Vest accounts to pay lamports into Stake accounts.

@garious garious force-pushed the garious:see-my-vest branch 4 times, most recently from 3ae62ff to b797575 Sep 27, 2019
@codecov

This comment has been minimized.

Copy link

codecov bot commented Sep 28, 2019

Codecov Report

Merging #5987 into master will increase coverage by 0.2%.
The diff coverage is 96.1%.

@@           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
@rob-solana

This comment has been minimized.

Copy link
Contributor

rob-solana commented Sep 28, 2019

@rob-solana, we can setup the Vest accounts to pay lamports into Stake accounts.

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

@garious garious marked this pull request as ready for review Oct 3, 2019
@garious garious force-pushed the garious:see-my-vest branch from 3ff7f60 to 9909408 Oct 3, 2019
@garious garious force-pushed the garious:see-my-vest branch from 8940fef to d9ad6f1 Oct 3, 2019
@CriesofCarrots CriesofCarrots self-requested a review Oct 3, 2019
@garious garious force-pushed the garious:see-my-vest branch from d9ad6f1 to 561301c Oct 4, 2019
Copy link
Contributor

CriesofCarrots left a comment

Functionality lgtm
r+ a couple comment nits
Also made a couple variable suggestions, take 'em or leave 'em

programs/vest_api/src/vest_instruction.rs Outdated Show resolved Hide resolved
programs/vest_api/src/vest_processor.rs Outdated Show resolved Hide resolved
programs/vest_api/src/vest_state.rs Outdated Show resolved Hide resolved
programs/vest_api/src/vest_processor.rs Outdated Show resolved Hide resolved
programs/vest_api/src/vest_schedule.rs Outdated Show resolved Hide resolved
@mergify mergify bot dismissed CriesofCarrots’s stale review Oct 4, 2019

Pull request has been modified.

garious added 3 commits Oct 4, 2019
@garious garious added the automerge label Oct 4, 2019
@solana-grimes solana-grimes merged commit 5617162 into solana-labs:master Oct 4, 2019
11 checks passed
11 checks passed
Summary 1 rule matches and 7 potential rules
Details
buildkite/solana Build #12676 passed (29 minutes, 27 seconds)
Details
buildkite/solana/bench Passed (19 minutes, 12 seconds)
Details
buildkite/solana/checks Passed (2 minutes, 35 seconds)
Details
buildkite/solana/coverage Passed (26 minutes, 29 seconds)
Details
buildkite/solana/local-cluster Passed (14 minutes, 3 seconds)
Details
buildkite/solana/pipeline-upload Passed (8 seconds)
Details
buildkite/solana/shellcheck Passed (29 seconds)
Details
buildkite/solana/stable Passed (17 minutes, 10 seconds)
Details
buildkite/solana/stable-perf Passed (8 minutes, 57 seconds)
Details
ci-gate Pull Request accepted for CI pipeline
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
5 participants
You can’t perform that action at this time.