The Boost Protocol collects protocol fees from budgets on 3 distinct occasions:
At time of Boost creation, transferring assets to incentives from budgets
On claim, recouping assets from the incentive’s backing asset
On retrieving assets from an incentive back to a budget
At time of writing, the base protocol fee in basis points is 10% and, for any qualifying event, the math can be summarized with the following equation:
For ERC20 incentives, you’ll want to ensure your budget has enough assets to cover the full amount that can be claimed by users, as well as the protocol fee. The following is a simple code sample that can help ensure your new Boost does not revert with an Insufficient Funds error.
Copy
Ask AI
// Initialize your incentive configurationconst erc20Incentive = core.ERC20Incentive({ asset: '0xERC20', strategy: StrategyType.POOL, reward: 100n, limit: 10n, manager: budget.assertValidAddress(),});// Acquire the total amount that can be distributed from the incentiveconst totalBudget = await erc20Incentive.getTotalBudget()// Calculate the protocol feeconst fee = await core.calculateProtocolFee(totalBudget)// Calculate the total amount required to fund the incentiveconst totalFundingAmount = totalBudget + fee// Approve your erc20 to send the full funding amount to the budgetawait writeContract(wagmiConfig, { abi: erc20Abi, address: '0xERC20', // The address of the ERC20 token you want to approve functionName: 'approve', args: [ budget.assertValidAddress(), // The address of the budget account totalFundingAmount ],})// Allocate assets to the budget from your accountawait budget.allocate({ amount: totalFundingAmount, asset: '0xERC20', target: "0xME",})// On create, `totalBudget` will be transferred to incentive, and `fee` will be transferred to the protocolconst boost = await core.createBoost({ ...otherParams, incentives: [erc20Incentive],});