Skip to content
This repository has been archived by the owner on Nov 15, 2023. It is now read-only.

Adding vesting logic to claims #637

Merged
merged 6 commits into from
Dec 2, 2019
Merged

Adding vesting logic to claims #637

merged 6 commits into from
Dec 2, 2019

Conversation

shawntabrizi
Copy link
Member

@shawntabrizi shawntabrizi commented Dec 2, 2019

This adds vesting logic to the claims module. Fixes #612.

  • There is a new storage item that can be configured at genesis.
/// Vesting schedule for a claim.
/// First balance is the total amount that should be held for vesting.
/// Second balance is how much should be unlocked per block.
/// The block number is when the vesting should start.
Vesting get(vesting) config(): map EthereumAddress => Option<(BalanceOf<T>, BalanceOf<T>, T::BlockNumber)>;
  • When a user submits a claim, we check:

    • There actually exists a claim
    • If the claim has a vesting schedule attached, that we can apply it to the account that the user wants. This means accounts that already have a vesting schedule applied to them cannot be the target of a claim with a vesting schedule attached. The runtime will return an error and nothing is changed.
  • If all checks pass, we clean up the Claims and Vesting storage items, then try to transfer the funds.

  • mint_claim is updated to support an optional vesting schedule that will be written to storage if provided.

  • Tests updated.

@shawntabrizi shawntabrizi added the A0-please_review Pull request needs code review. label Dec 2, 2019
runtime/src/claims.rs Outdated Show resolved Hide resolved
Co-Authored-By: Bastian Köcher <bkchr@users.noreply.github.com>
@shawntabrizi
Copy link
Member Author

Please do not merge until polkadot-master branch is updated again :)

It needs paritytech/substrate#4257

@gavofyork
Copy link
Member

will need a runtime bump.

runtime/src/claims.rs Outdated Show resolved Hide resolved
@gavofyork gavofyork merged commit d7a89be into paritytech:master Dec 2, 2019
@shawntabrizi shawntabrizi deleted the shawntabrizi-vesting-claims branch December 2, 2019 16:56
tomusdrw pushed a commit that referenced this pull request Mar 26, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Claims module doesn't handle vesting
4 participants