Contract 8458d58865622d1500ac28328367761ec825f18209cd98186afdc7a8b0a21075

← Back to Index 📥 Download WASM

Meta

rssdkver 22.0.5#25daaf397971f2c15fd2a5fd0a9967020a19cfcb
rsver 1.81.0

Instances

  • CAYFRDJ3ADI3H26LXXOKST2EMOM5C22O4IAMLAPUQXID7KSH3WSSS7WK

Interface

Initializes the contract and sets admin for it

Examples

fn initialize(
    env: soroban_sdk::Env,
    admin: soroban_sdk::Address,
    xlm: soroban_sdk::Address,
    monthly_fee: i128,
) -> Result<(), CustomErrors>

Returns the admin of the Fluxity contract

Examples

let admin = fluxity_client::get_admin();
fn get_admin(env: soroban_sdk::Env) -> soroban_sdk::Address

Returns the address of the XLM token

Examples

let xlm_address = fluxity_client::get_xlm();
fn get_xlm(env: soroban_sdk::Env) -> soroban_sdk::Address

Sets the monthly fee for lockups. Only the admin can call this

Examples

let id = fluxity_client::set_monthly_fee(200);
fn set_monthly_fee(env: soroban_sdk::Env, fee: i128)

Returns the monthly fee for lockups

Examples

let fee = fluxity_client::get_monthly_fee();
fn get_monthly_fee(env: soroban_sdk::Env) -> i128

Returns the latest lockup id

Examples

let id = fluxity_client::get_latest_stream_id();
fn get_latest_lockup_id(env: soroban_sdk::Env) -> u64

Returns the fee calculated based on the start and end time of a lockup

Examples

let fee = fluxity_client::calculate_fee();
fn calculate_fee(env: soroban_sdk::Env, start_date: u64, end_date: u64) -> i128

Returns a lockup by id

Examples

let lockup_id = 20;

fluxity_client::get_lockup(&stream_id);
fn get_lockup(env: soroban_sdk::Env, id: u64) -> Result

Cancels a lockup

Examples

let lockup_id = 20;

fluxity_client::cancel_lockup(&lockup_id);
fn cancel_lockup(env: soroban_sdk::Env, id: u64) -> Result<(i128, i128), CustomErrors>

Withdraws from a lockup, anyone call call this function even for others

Examples

let lockup_id = 20;
let amount_to_withdraw = 30000000 // Represents 3 in a 7-decimal token

fluxity_client::withdraw_lockup(&stream_id, &amount_to_withdraw);
fn withdraw_lockup(
    env: soroban_sdk::Env,
    id: u64,
    amount: i128,
) -> Result

Creates a lockup (stream/vesting)

Examples

let params = LockupInput {
sender: Address::random(&env),
receiver: Address::random(&env),
token: Address::random(&env),
amount: 20000000,
start_date: now,
cancellable_date: now,
cliff_date: now + 100,
end_date: now + 1000,
rate: Rate::Daily,
is_vesting: true
};

fluxity_client::create_lockup(&params);
fn create_lockup(
    env: soroban_sdk::Env,
    params: LockupInput,
) -> Result

Increases the duration and the amount of a lockup

Examples

let lockup_id = 56;
let adding_amount = 700000000;

fluxity_client::topup_lockup(lockup_id, adding_amount);
fn topup_lockup(
    env: soroban_sdk::Env,
    id: u64,
    adding_amount: i128,
) -> Result

Imports

WebAssembly Text (WAT) ▶