• Calculate Nervos DAO profit between two blocks. This function computes the profit earned from a Nervos DAO deposit based on the capacity and the time period between deposit and withdrawal.

    Parameters

    • profitableCapacity: NumLike

      The capacity that earns profit (total capacity minus occupied capacity).

    • depositHeaderLike: ClientBlockHeaderLike

      The block header when the DAO deposit was made.

    • withdrawHeaderLike: ClientBlockHeaderLike

      The block header when the DAO withdrawal is made.

    Returns Num

    The profit amount in CKB (capacity units).

    const profit = calcDaoProfit(
    ccc.fixedPointFrom(100), // 100 CKB profitable capacity
    depositHeader,
    withdrawHeader
    );
    console.log(`Profit: ${profit} shannons`);