CFP
Contract Reference
Factory Ref

CrowdFi V1 Factory Reference

Git Source (opens in a new tab)

Inherits: Ownable

Author: Fabric Inc.

A factory which leverages Clones to deploy Fabric CrowdFinancing contracts

State Variables

_implementation

The campaign contract implementation address

address immutable _implementation;

_feeCollector

The fee collector address (can be 0, no fees are collected)

address private _feeCollector;

_feeTransferBips

The transfer fee (See CrowdFinancingV1)

uint16 private _feeTransferBips;

_feeYieldBips

The yield fee (See CrowdFinancingV1)

uint16 private _feeYieldBips;

_feeDeployMin

Fee to collect upon deployment

uint256 private _feeDeployMin;

Functions

feeRequired

modifier feeRequired();

constructor

constructor(address implementation) Ownable;

Parameters

NameTypeDescription
implementationaddressthe CrowdFinancingV1 implementation address

deployCampaign

Deploys a new CrowdFinancingV1 contract

function deployCampaign(
    address recipient,
    uint256 minGoal,
    uint256 maxGoal,
    uint256 minContribution,
    uint256 maxContribution,
    uint32 holdOff,
    uint32 duration,
    address erc20TokenAddr
) external payable feeRequired returns (address);

Parameters

NameTypeDescription
recipientaddressthe address of the recipient, to which funds can be transferred after success
minGoaluint256the minimum funding amount acceptable for a successful campaign
maxGoaluint256the maximum funding amount accepted for the financing round
minContributionuint256the minimum initial contribution an account can make
maxContributionuint256the maximum contribution an account can make
holdOffuint32the number of seconds to wait until the campaign starts
durationuint32the runtime of the campaign, in seconds
erc20TokenAddraddressthe address of the ERC20 token used for payments, or the 0 address for native token

Returns

NameTypeDescription
<none>addressthe address of the deployed CrowdFinancingV1 contract

transferDeployFees

Owner Only: Transfer accumulated fees

function transferDeployFees(address recipient) external onlyOwner;

updateFeeSchedule

Owner Only: Update the fee schedule for future deployments

function updateFeeSchedule(address feeCollector, uint16 feeTransferBips, uint16 feeYieldBips) external onlyOwner;

Parameters

NameTypeDescription
feeCollectoraddressthe address of the fee collector, or the 0 address if no fees are collected
feeTransferBipsuint16the upfront fee in basis points, calculated during processing
feeYieldBipsuint16the payout fee in basis points. Dilutes the cap table for fee collection

updateMinimumDeployFee

Owner Only: Update the deploy fee.

function updateMinimumDeployFee(uint256 minFeeAmount) external onlyOwner;

Parameters

NameTypeDescription
minFeeAmountuint256the amount of wei required to deploy a campaign

feeSchedule

Fetch the fee schedule for campaigns and the deploy fee

function feeSchedule()
    external
    view
    returns (address collector, uint16 transferFee, uint16 yieldFee, uint256 deployFee);

Returns

NameTypeDescription
collectoraddressthe address of the fee collector, or the 0 address if no fees are collected
transferFeeuint16the upfront fee in basis points, calculated during transfer
yieldFeeuint16the payout fee in basis points. Dilutes the cap table for fee collection
deployFeeuint256the amount of wei required to deploy a campaign

Events

Deployment

Emitted upon a successful Campaign deployment

event Deployment(address indexed deployment);

FeeScheduleChange

Emitted when the fee collector or schedule changes

event FeeScheduleChange(address feeCollector, uint16 upfrontBips, uint16 payoutBips);

DeployFeeChange

Emitted when the creation fee minium changes

event DeployFeeChange(uint256 fee);

DeployFeeTransfer

Emitted when the deploy fees are collected by the owner

event DeployFeeTransfer(address indexed recipient, uint256 fee);