Initializes the contract and sets admin for it
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
let admin = fluxity_client::get_admin();
fn get_admin(env: soroban_sdk::Env) -> soroban_sdk::Address
Returns the address of the XLM token
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
let id = fluxity_client::set_monthly_fee(200);
fn set_monthly_fee(env: soroban_sdk::Env, fee: i128)
Returns the monthly fee for lockups
let fee = fluxity_client::get_monthly_fee();
fn get_monthly_fee(env: soroban_sdk::Env) -> i128
Returns the latest lockup id
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
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
let lockup_id = 20;
fluxity_client::get_lockup(&stream_id);
fn get_lockup(env: soroban_sdk::Env, id: u64) -> Result
Cancels a lockup
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
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)
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(¶ms);
fn create_lockup(
env: soroban_sdk::Env,
params: LockupInput,
) -> Result
Increases the duration and the amount of a lockup
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