Contract fa5931c6df700e43f5bcc367d1dc1e0cb8142911e22ff1064e0cd3c288f4bd7e

← Back to Index 📥 Download WASM

Meta

Description DobProtocol Crowdfunding V1 - Fixed price per share, on-chain escrow
cliver 27.0.0#5a7c5fe76530bf4248477ac812fc757146b98cc4
home_domain dobprotocol.com
rssdkver 23.5.3#d3e1ab2424388b10893b796b0c8e405c5edd03d2
rsver 1.97.1
source_repo github:Dobprotocol/stellar-distribution-contracts

Interface

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)>

Imports

WebAssembly Text (WAT) ▶