Initialise the campaign.
price_per_share: payment_token units for 1 share out of 1 000 000.soft_cap_shares: minimum shares sold to mark campaign Succeeded [1, 1 000 000].hard_cap_shares: maximum shares available [soft_cap, 1 000 000].
Pass 1 000 000 for no effective hard cap.deadline: unix timestamp after which finalize() can be called.payout_mode: 0 = Escrow (raised funds → splitter), 1 = DirectToOwner
(raised funds → admin, resell mode). Fixed at init and public
thereafter, so an investor knows before contributing where the money
goes on activation.fn init(
env: soroban_sdk::Env,
admin: soroban_sdk::Address,
payment_token: soroban_sdk::Address,
price_per_share: i128,
soft_cap_shares: i128,
hard_cap_shares: i128,
deadline: u64,
payout_mode: u32,
) -> Result<(), soroban_sdk::Error>
Claim a refund after a Failed campaign. Returns payment_token to the investor proportional to their contribution.
fn refund(
env: soroban_sdk::Env,
investor: soroban_sdk::Address,
) -> Result
INVESTOR Leave the campaign and reclaim the full contribution while an activation proposal is still inside its notice period. Doing so also withdraws the proposal, so the admin must re-propose against the corrected contributor list.
fn opt_out(
env: soroban_sdk::Env,
investor: soroban_sdk::Address,
) -> Result
ADMIN ONLY Upgrade the contract WASM to a new version.
fn upgrade(
env: soroban_sdk::Env,
new_wasm_hash: soroban_sdk::BytesN<32>,
) -> Result<(), soroban_sdk::Error>
ADMIN ONLY — step 2 of 2. Transfer all raised funds to the splitter
proposed earlier, once its timelock has elapsed. splitter_address must
equal the proposed one.
fn activate(
env: soroban_sdk::Env,
splitter_address: soroban_sdk::Address,
) -> Result
Evaluate success/failure after deadline (callable by anyone). Sets status to Succeeded if total_shares_sold >= soft_cap_shares, else Failed.
fn finalize(env: soroban_sdk::Env) -> Result
Buy shares_amount shares during the fundraising period.
Transfers shares_amount × price_per_share payment_token from investor to contract.
Returns the total payment amount transferred.
fn contribute(
env: soroban_sdk::Env,
investor: soroban_sdk::Address,
shares_amount: i128,
) -> Result
fn get_config(env: soroban_sdk::Env) -> Result
fn get_status(env: soroban_sdk::Env) -> Result
fn get_splitter(env: soroban_sdk::Env) -> Option
fn get_contribution(env: soroban_sdk::Env, investor: soroban_sdk::Address) -> i128
fn get_total_raised(env: soroban_sdk::Env) -> i128
ADMIN ONLY Withdraw a pending activation proposal.
fn cancel_activation(env: soroban_sdk::Env) -> Result<(), soroban_sdk::Error>
Callable by anyone. Flips a SUCCEEDED-but-never-activated campaign to Failed once the activation window has closed, opening refunds. This is the investors' guarantee that an absent admin cannot strand their money.
fn expire_activation(
env: soroban_sdk::Env,
) -> Result
ADMIN ONLY — step 1 of 2. Announce the splitter that will receive the
escrow. The address is probed (it must be a live splitter) and published
on-chain; activate becomes callable at the returned ETA.
fn propose_activation(
env: soroban_sdk::Env,
splitter_address: soroban_sdk::Address,
) -> Result
The splitter awaiting its timelock, if any, and the timestamp from which
activate will accept it.
fn get_pending_activation(env: soroban_sdk::Env) -> Option<(soroban_sdk::Address, u64)>