CFP
Campaign Deployment

Deploying a CrowdFi Contract

CrowdFi contracts are deployed by invoking the deployCampaign function on the factory contract for a given network. The function uses OpenZeppelin Clones to create a proxy and initialize the contract with campaign parameters.

Campaign Parameters

NameTypeDescription
recipientaddressthe address of the recipient, where funds are sent on success
minGoaluint256the minimum funding amount acceptable for successful financing
maxGoaluint256the maximum funding amount accepted for the financing round
minContributionuint256the minimum deposit an account can make in one deposit
maxContributionuint256the maximum deposit an account can make in one or more deposits
holdOffuint32the number of seconds to wait until the campaign starts
durationuint32the runtime of the campaign, in seconds
erc20TokenAddraddressthe address of the ERC-20 token used for payments, or 0 address for native token

Native Token vs ERC-20

CrowdFi contracts support native tokens as well as ERC-20 compliant tokens. The contribute and yield functions are different depending on whether the contract is native token or ERC-20 denominated.

️🚫

CrowdFi contracts do not support rebasing tokens! Do not use them as the denominated token.

⚠️

CrowdFi contracts support fee taking tokens. The number of CrowdFi tokens minted on contribution will factor in the fee.

Factory Addresses

ChainFactory
Ethereum0x8e78D80599197C501353453f73B0B92A402077d6 (opens in a new tab)
OP Mainnet0x19eaD00ce8961cfFca0551244DC07D87e6Ff8F7E (opens in a new tab)
Polygon0xf53e3729aC1caDd24D5986b2738D0DEE5f4eD30A (opens in a new tab)
Base0xf53e3729aC1caDd24D5986b2738D0DEE5f4eD30A (opens in a new tab)
Arbitrum One0x24379629781d03a0Fe67D9712FD2d76a92EfEF14 (opens in a new tab)
Zora0xf53e3729aC1caDd24D5986b2738D0DEE5f4eD30A (opens in a new tab)
Sepolia0x83a322729C3172B0cc6Bf3a3204Fa83E683c584E (opens in a new tab)

Example Deployment

import { Contract, Signer } from 'ethers';
const abi = require('path/to/CrowdFinancingV1Factory.abi.json');
const contract = new Contract(factoryContractAddress, abi, signer);
 
// Native token (ETH)
const erc20TokenAddress = '0x0000000000000000000000000000000000000000';
 
const tx = await contract.deployCampaign(
  recipientAddress,
  minGoal,
  maxGoal,
  minContribution,
  maxContribution,
  holdOffSeconds,
  durationSeconds,
  erc20TokenAddress,
);
 
console.log('deploy tx', tx);