Skip to main content
See also: API Reference Examples — executable TypeScript walkthroughs.

The Business

TechForge is a technology platform that helps hardware startups raise funds from their community. Unlike all-or-nothing crowdfunding, TechForge uses a keep-what’s-raised model: creators keep whatever they raise, even if they don’t hit their goal. This works well for hardware projects where any amount of funding helps move the project forward. TechForge also lets backers add tips to their pledges, charges payment gateway fees on each pledge, and allows creators to make partial withdrawals during the campaign (with platform approval) to cover manufacturing costs before the deadline. Tips are collected by the platform via claimTip and sent to the configured platform tip recipient.

Why Oak?

TechForge needs:
  • Flexible funding — creators keep whatever is raised, no all-or-nothing threshold
  • Partial withdrawals — creators can withdraw funds mid-campaign with platform approval
  • Tips — backers can tip on top of their pledge; tips are claimable separately
  • Payment gateway fees — per-pledge fees recorded on-chain for transparent accounting
  • Configurable fee structure — flat fees, percentage fees, and cumulative fee caps
  • Refund delay — backers can refund, but only after a configurable delay period post-deadline
  • Reward tiers — like all-or-nothing, but with the flexibility of partial delivery

Oak Contracts Used

Multi-token support

Campaigns accept a whitelist of ERC-20s resolved from the campaign currency; each pledge and withdrawal names pledgeToken / token explicitly, and the treasury enforces isTokenAccepted. Balances, tips, gateway fees, and withdrawals are tracked per token contract (each token’s decimals). Examples below use USDC; TechForge can enable additional accepted tokens the same way—GlobalParams maintains currencyToTokens (initialize, then addTokenToCurrency / removeTokenFromCurrency); campaign.getAcceptedTokens() lists what a given campaign accepts after creation.

How KeepWhatsRaised Differs from AllOrNothing

Roles

Integration Flow

Step 1: Create the campaign

Lena wants to fund her open-source IoT sensor kit. She needs $15,000 ideally but any amount helps. TechForge creates the campaign on-chain.
After the transaction is mined, resolve the deployed CampaignInfo address. Two approaches are available — prefer the receipt-based one when you have the receipt in hand. Approach 1 — Decode CampaignCreated from the receipt (recommended). Deterministic and works immediately, regardless of RPC indexing lag.
Approach 2 — Look up via identifierToCampaignInfo (convenience). Handy when you only have the identifier hash and did not keep the receipt.

Step 2: Deploy the KeepWhatsRaised treasury

TechForge deploys a KWR treasury for Lena’s campaign. Implementation ID 1 = KeepWhatsRaised.

Step 3: Configure the treasury

This is unique to KeepWhatsRaised — the platform must configure delays, refund policy, and fee structure before the treasury is operational.

Step 4: Add reward tiers

Lena defines two reward tiers.

Step 5: Backers pledge with tips

Backers pledge to Lena’s campaign. KWR supports tips (on top of the pledge), which go directly to the platform. Pledge with a reward and a tip:
Role: Any caller (backer)pledgeForAReward is permissionless but time-gated (must be within the campaign window).
Pledge without a reward:
Role: Any caller (backer)pledgeWithoutAReward is permissionless but time-gated.

Step 5b: Platform records payment gateway fees

Role: Platform AdminsetPaymentGatewayFee and setFeeAndPledge are admin-gated (onlyPlatformAdmin). These are called by the platform backend, not by the backer.
Platforms that charge on-ramp or payment processing fees can record them on-chain for transparent accounting. There are two approaches: Record a gateway fee for an existing pledge:
Combined fee + pledge in one transaction — records the gateway fee and creates the pledge atomically. Tokens are transferred from the admin wallet:

Step 6: Mid-campaign partial withdrawal

Lena needs funds to order components from her supplier. TechForge approves a partial withdrawal. Platform approves the withdrawal:
Creator executes the partial amount (only after withdrawalDelay seconds since approval, unless the delay is 0 in configureTreasury for a walkthrough):

Step 7: Monitor campaign progress

TechForge’s dashboard shows live progress with all KWR-specific metrics.

Step 8: Disburse fees

After the campaign, protocol and platform fees are distributed.

Step 9: Platform claims tips

Tips are claimed separately by the platform. The claimTip function transfers accumulated tips to the platform tip recipient (configured during platform enlistment).

Step 10: Platform claims remaining funds

After the deadline + claim delay period, the platform claims any remaining funds for the creator.

Step 11: Backer claims refund (after refund delay)

If a backer wants a refund, they can claim one — but only after the deadline + the configured refund delay (14 days in this example). Before calling claimRefund, the backer must approve the treasury to manage their pledge NFT. Pledge NFTs live on the CampaignInfo contract, so approve is called on the CampaignInfo entity:

Optional: Update campaign parameters

KWR allows updating the deadline and goal mid-campaign (subject to config lock period).

Architecture Diagram

TechForge Keep-What’s-Raised Campaign Flow

Key Takeaways

  • configureTreasury is mandatory and unique to KWR — it sets withdrawal delays, refund delays, and the full fee structure before the treasury operates
  • Partial withdrawals let creators access funds mid-campaign, but require explicit platform approval via approveWithdrawal()
  • Tips are a separate fund pool claimed via claimTip(), distinct from pledges
  • Payment gateway fees are tracked per-pledge with setPaymentGatewayFee() or combined with the pledge in setFeeAndPledge()
  • Refund delay protects creators from last-minute refund rushes — backers can only refund after deadline + configured delay
  • Three claim methods serve different purposes: claimFund() for main funds, claimTip() for tips, claimRefund() for backers
  • withdraw() takes a specific token and amount, unlike AllOrNothing where withdraw() sweeps everything
  • Multi-token — pledges and withdrawals name the ERC-20 explicitly; only whitelisted tokens are accepted; accounting is per token
  • Campaign parameters are updatable (updateDeadline, updateGoalAmount) subject to config lock period