Yield
⚠️
Yields may require regulatory compliance.
The CrowdFi protocol supports splitting yield between token holders. If the purpose of the campaign was to finance a project which produces yield, that yield may be deposited to the contract and all token holders can then withdraw their pro-rata share at any time.
Yielding Native Tokens
Here is an example of depositing yield back into the contract.
const txn = await crowdfiContract.yieldEth({ value: BigInt(Math.pow(10, 18)) })
Yielding ERC-20 Tokens
Here is a corresponding example for an ERC-20 denominated campaign. Of course, like contributions, ERC-20 yields require allowances.
const amount = BigInt((Math.pow(10, 6));
const approveTxn = await tokenContract.approve(crowdfiContract.address, amount);
// await mining...
const yieldTxn = await crowdfiContract.yieldERC20(amount);