Contract bf0a3d1edfda3773903c9eb91f34d570577f5962f282ac95ccb31fd9d67a22ec

← Back to Index 📥 Download WASM

Meta

Description DobProtocol Crowdfunding V1 - Fixed price per share, on-chain escrow
cliver 23.2.1#496ac35be7a7d8d923fcde9bbbc650ee593d1f6f
home_domain dobprotocol.com
rssdkver 23.5.3#d3e1ab2424388b10893b796b0c8e405c5edd03d2
rsver 1.91.1
source_repo github:Dobprotocol/stellar-distribution-contracts

Instances

  • CBAIEA6AEOTHV7WJHZ7CF4GQAK2Y55ZRRWRQJHXZV5GYMB33S4B7G6P6
  • CCRPQ4WRE5QJMSDGR6CEGDWVB5ZJB3IQJLVPUQLCQGEF23WRHLBXKJU5

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 (funds → splitter on activate, default), 1 = DirectToOwner (funds → admin on activate, resell mode).
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

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>

Transfer all raised funds to the splitter contract after a successful campaign. Admin must deploy the V1 splitter externally first, then call this. The splitter should be initialised with shares proportional to contributions.

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

Imports

WebAssembly Text (WAT) ▶