GithubHelp home page GithubHelp logo

vesting-example's Introduction

Vesting

Overview

This folder contains a Soroban smart contract example for a vesting schedule, a digital agreement that governs the gradual transfer of ownership rights, typically for assets like company stock or crypto tokens. It demonstrates defining, adding, and withdrawing vesting schedules, showcasing how to implement and interact with smart contracts on the Stellar network using Soroban.

Contract Functions

Function Name Parameters Return Type Description
new_vesting
env: Env
token: Address
beneficiary: Address
start_time: u64
duration: u64
admin: Address
Result<u64, VestError> Initializes a new vesting schedule with specific parameters. start_time is a UNIX timestamp, while duration is in seconds. admin is the user who will be allowed to call add_vest().
add_vest
env: Env
id: u64
token: Address
from: Address
amount: i128
Result<i128, VestError> Adds funds to a specified vesting account. Pass as id the value returned by new_vesting().
retrievable_balance
env: Env
id: u64
Result<i128, VestError> Retrieves the balance that is currently withdrawable by the beneficiary from the vesting account. Pass as id the value returned by new_vesting().
pay_out
env: Env
id: u64
Result<i128, VestError> Transfers any currently available funds to the beneficiary's account. Note that anyone can call this function on behalf of the beneficiary. Pass as id the value returned by new_vesting().

Interacting with the Contract

  1. Create a Vesting Schedule. To create and define the vesting schedule with its corresponding parameters use the function new_vesting().

  2. Add Funds. To add the necessary funds to the vesting use add_vest().

  3. Check Balance. In order to check the balance at the moment for a particular user, call retrievable_balance().

  4. Withdraw Balance: For the user to withdraw balance use pay_out().

Security Review

๐Ÿ‘‰ Navigate to this link to view the security review.

vesting-example's People

Contributors

arturobeccar avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.