The following readme describes all the functions and their parameters exposed by the fundSplitter class of the K2 SDK. This sub-class contains all the important functions from the Fund Splitter contract of the K2 Lending protocol.

distributeNewRewards function

Distribute the new rewards to the PNOs and redelegators.

Input Parameters

rewardToken: The address of the reward token
rewardAmount: The reward amount in string
PNOs: Array of ETH addresses of the PNOs

Using distributeNewRewards function

await sdk.fundSplitter.distributeNewRewards(rewardToken, rewardAmount, PNOs);

Return Parameters

Transaction details if the transaction was successful.

claimFromRedelegationBucket function

Claim rewards from the redelegation bucket after it has been distributed.

Input Parameters

user: The ETH address of the user
distributionIndex: The distribution index in string
PNOs: Array of ETH addresses of the PNOs

Using claimFromRedelegationBucket function

await sdk.fundSplitter.claimFromRedelegationBucket(user, distributionIndex, PNOs);

Return Parameters

Transaction details if the transaction was successful.

claimFromPNOBucket function

Claim PNO earnings from the PNO bucket after it has been distributed.

Input Parameters

pno: The ETH address of the PNO
rewardTokens: Array of reward token addresses

Using claimFromPNOBucket function

await sdk.fundSplitter.claimFromPNOBucket(pno, rewardTokens);

Return Parameters

Transaction details if the transaction was successful.

onPNOEnabled function

Hook function to track PNOs enabled status.

Input Parameters

pno: The ETH address of the PNO
enabled: Boolean value, true if enabled

Using onPNOEnabled function

await sdk.fundSplitter.onPNOEnabled(pno, enabled);

Return Parameters

Transaction details if the transaction was successful.

pnoHistoricalEarnings function

Get the historical earnings for the given PNO, for the default reward token.

Input Parameters

pno: The ETH address of the PNO

Using pnoHistoricalEarnings function

await sdk.fundSplitter.pnoHistoricalEarnings(pno);

Return Parameters

Returns the historical PNO earnings in bigint.

pnoHistoricalEarningsForRewardToken functions

Get the historical earnings for the given PNO and the given reward token.

Input Parameters

pno: The ETH address of the PNO
rewardToken: Address of the reward token

Using pnoHistoricalEarningsForRewardToken function

await sdk.fundSplitter.pnoHistoricalEarningsForRewardToken(pno, rewardToken);

Return Parameters

Returns the historical PNO earnings in bigint.

isPNOEnabledAt function

Checks if the PNO was enabled at the given snapshot.

Input Parameters

pno: The ETH address of the PNO
snapshotId: The snapshot id in string

Using isPNOEnabledAt function

await sdk.fundSplitter.isPNOEnabledAt(pno, snapshotId);

Return Parameters

Return true if the PNO was enabled, else false.