Contract 0dfec6396c840c218fd4a92855544d52f10d34dac397d27fb6cd49956a31d4ff

← Back to Index 📥 Download WASM

Meta

Description DobProtocol Crowdfunding V1 - Fixed price per share, on-chain escrow
rssdkver 23.4.0#673d6c4f2368d282d25da29bda55c21b8be69ca6
rsver 1.92.0

Instances

  • CASEG6OE2JD4QLBTCXNGYYNWRSB6ZLLXKWBRQ7IET4BH3VMW32B3WQWW
  • CBO2QM5X44HHW3KPFDER7T65M5THQEKDI3VEJD5KFATYOEXUEXSBGAQY
  • CCDL5OMZ6PVLJKMJ4ZPE7PBTEMXXNUVFFWN7PMTGQXY6JG6FKWCL5AG6
  • CCXLKOJ6AHC3RCK4M3FNXS6TIJJHY4ZKWIVGJVXFBH5VYXQ4H2KGY4MA
  • CCZOZRWZ4MTHFW3MNXMTOIFO4NHTNTHUUTVJVHBZ6ALAJBKWCIAQETYB

Interface

Initialise the campaign.

  • price_per_share: payment_token units for 1 share out of 10 000.
  • soft_cap_shares: minimum shares sold to mark campaign Succeeded [1, 10 000].
  • hard_cap_shares: maximum shares available [soft_cap, 10 000]. Pass 10 000 for no effective hard cap.
  • deadline: unix timestamp after which finalize() can be called.
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,
) -> 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

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