Skip to content

Commit

Permalink
vesting: initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
gangov committed Apr 23, 2024
1 parent c448adf commit 7e58138
Show file tree
Hide file tree
Showing 8 changed files with 108 additions and 1 deletion.
11 changes: 11 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
SUBDIRS := contracts/factory contracts/multihop contracts/pool contracts/pool_stable contracts/stake contracts/token packages/phoenix packages/decimal packages/curve
SUBDIRS := contracts/factory contracts/multihop contracts/pool contracts/pool_stable contracts/stake contracts/token contracts/vesting packages/phoenix packages/decimal packages/curve
BUILD_FLAGS ?=

default: build
Expand Down
23 changes: 23 additions & 0 deletions contracts/vesting/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
[package]
name = "phoenix-vesting"
version = { workspace = true }
authors = ["Jakub <[email protected]>", "Kaloyan <[email protected]>"]
repository = { workspace = true }
edition = { workspace = true }
license = { workspace = true }

[lib]
crate-type = ["cdylib"]

[features]
testutils = ["soroban-sdk/testutils"]

[dependencies]
decimal = { workspace = true }
curve = { workspace = true }
phoenix = { workspace = true }
soroban-sdk = { workspace = true }

[dev_dependencies]
soroban-sdk = { workspace = true, features = ["testutils"] }
pretty_assertions = { workspace = true }
20 changes: 20 additions & 0 deletions contracts/vesting/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
default: all

all: lint build test

test: build
cargo test

build:
cargo build --target wasm32-unknown-unknown --release

lint: fmt clippy

fmt:
cargo fmt --all

clippy: build
cargo clippy --all-targets -- -D warnings

clean:
cargo clean
3 changes: 3 additions & 0 deletions contracts/vesting/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# VESTING

TODO!
31 changes: 31 additions & 0 deletions contracts/vesting/src/contract.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
use soroban_sdk::{contract, contractimpl, contractmeta, Address, Env, Vec};

use curve::Curve;

// Metadata that is added on to the WASM custom section
contractmeta!(key = "Description", val = "Phoenix Protocol Vesting");

#[contract]
pub struct Vesting;

pub trait VestingTrait {
// Sets the token contract addresses for this pool
fn initialize(env: Env, admin: Address);

fn create_vesting_accounts(env: Env, accounts: Vec<Address>);

fn transfer_token(env: Env, from: Address, to: Address, amount: i128);

fn transfer_vesting(env: Env, from: Address, to: Address, amount: i128, curve: Curve);

fn burn(env: Env, amount: i128);

fn mint(env: Env, sender: Address, to: Address, amount: i128);

fn update_minter(env: Env, sender: Address, new_minter: Address);

// fn send(env: Env, )
}

#[contractimpl]
impl VestingTrait for Vesting {}
12 changes: 12 additions & 0 deletions contracts/vesting/src/lib.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#![no_std]
mod contract;
mod storage;

pub mod token_contract {
// The import will code generate:
// - A ContractClient type that can be used to invoke functions on the contract.
// - Any types in the contract that were annotated with #[contracttype].
soroban_sdk::contractimport!(
file = "../../target/wasm32-unknown-unknown/release/soroban_token_contract.wasm"
);
}
7 changes: 7 additions & 0 deletions contracts/vesting/src/storage.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
use soroban_sdk::String;

pub struct VestingTokenInfo {
pub name: String,
pub symbol: String,
pub decimals: u8,
}

0 comments on commit 7e58138

Please sign in to comment.