The Boost V2 Docs are under active development and will be subject to changes.

The ManagedBudget contract allows authorized users to clawback or disburse funds from the budget.

API

clawback

The clawback function is used to reclaim available funds from the budget. Can only be called by owner or admin.

  • Using clawback with 0n will reclaim all available funds for the given asset.
  • Use the zero address (0x0000000000000000000000000000000000000000) to clawback native assets (ie. ETH).

Parameters

transfer
parameters
Omit<wagmi.WriteContractParameters, 'address' | 'args' | 'functionName' | 'abi'>

Optional parameters to pass to the underlying writeContract method. Checkout wagmi’s documentation for more information. address, args, functionName, abi are handled for you under the hood.

Returns

Promise<boolean>
boolean

Returns true if the clawback was successful.

clawbackFromTarget

The clawback function allows authorized users (admin or manager) to reclaim assets from a Boost’s incentive back to its associated budget.

The amount reclaimed will be subject to protocol fee collection, so attempting to reclaim an amount where reclaimAmount + calculatedProtocolFee > incentiveBalance will revert with an InsufficientFunds error.

For ERC20Incentive, the amount specified in the clawback data must be an exact multiple of the reward value set in the incentive. Otherwise, the transaction will fail.

Depending on the type of incentive, calculating the clawback amount will be different.

// Example for fixed-reward ERC20 incentives
const boost = await core.getBoost(0n)
const budget = boost.budget
const incentiveIndex = 0
const incentive = boost.incentives.at(incentiveIndex)

if (incentive instanceof ERC20Incentive) {
  // Calculate exact amount to clawback based on remaining claims
  const remainingClaims = await incentive.getRemainingClaimPotential()
  const rewardValue = await incentive.reward()
  const clawbackAmount = remainingClaims * rewardValue

  await budget.clawbackFromTarget(
    core.assertValidAddress(),
    incentive.buildClawbackData(clawbackAmount),
    boost.id,
    incentiveIndex
  );
}

Using clawbackFromTarget will modify the amount of the asset marked as distributed via the budget.

Parameters

target
address
required

The address of the contract implementing clawback, typically the Boost Core contract address.

data
Hex
required

The encoded clawback data payload. Generate this using incentive.buildClawbackData(amount).

boostId
bigint | number
required

The ID of the Boost containing the target incentive.

incentiveId
bigint | number
required

The index of the incentive to clawback from.

Returns

Promise<[amount, Address]>
Promise<[amount, Address]>

Returns a tuple containing:

  • The amount that was successfully clawed back
  • The address of the token that was retrieved

disburse

Transfers available funds from the budget to a specified recipient. You must have the manager, admin or owner role to call this function.

The disburse method is authorized for the MANAGER role. Be aware that this allows a manager to disburse funds from the budget at will. Make sure you trust the manager before giving them authorization.

Parameters

transfer
parameters
Omit<wagmi.WriteContractParameters, 'address' | 'args' | 'functionName' | 'abi'>

Optional parameters to pass to the underlying writeContract method. Checkout wagmi’s documentation for more information. address, args, functionName, abi are handled for you under the hood.

Returns

Promise<boolean>
boolean

Returns true if the disbursement was successful.

disburseBatch

Transfers available funds from the budget to a list of specified recipients. You must have the manager, admin or owner role to call this function. This method is more gas-efficient for multiple transfers.

Parameters

transfers
parameters
Omit<wagmi.WriteContractParameters, 'address' | 'args' | 'functionName' | 'abi'>

Optional parameters to pass to the underlying writeContract method. Checkout wagmi’s documentation for more information. address, args, functionName, abi are handled for you under the hood.

Returns

Promise<boolean>
boolean

Returns true if the disbursement was successful.