k2Lending
class of the K2 SDK. This class exposes all the important functions from the K2 Lending protocol.
setDelegatedRecipient function
This function can be used by the recipient of LST yield to further delegate claim rights to another recipient in exchange for something else.Input Parameters
recipient: ETH address of the new recipientUsing setDelegatedRecipient function
Return Parameter
Transaction details if the transaction was successful.getDebtor function
This function allows anyone to get the debtor related information just by the debtor address.Input Parameters
debtor: ETH address of the debtorUsing getDebtor function
Return Parameter
Returns data of a particular debtor.getBorrowDuration function
Get the borrow duration set by the contract.Using getBorrowDuration function
Return Parameter
Borrow duration in BigInt.getDAOAddress function
Get the DAO address associated with the contract.Using getDAOAddress function
Return Parameter
ETH address of the DAO.getProposerRegistry function
Get the proposer registry ETH address.Using getProposerRegistry function
Return Parameter
ETH address of the proposer registry.getNodeOperatorInclusionList function
Get the contract that manages the node operators eligible for native delegation.Using getNodeOperatorInclusionList function
Return Parameter
ETH address of the contract that manages the node operators eligible for native delegation.deposit function
Deposits KETH into the pool and mints pool shares to the sender.Input Parameters
amount: amount of kETH to be depositedUsing deposit function
Return Parameter
Transaction details if the transaction was successful.depositFor function
Deposit kETH for another ETH address.Input Parameters
amount: amount of kETH to be depositedrecipient: ETH address to deposit kETH for
Using depositFor function
Return Parameter
Transaction details if the transaction was successful.withdraw function
Burns shares from the sender and returns the equivalent fraction of remaining KETH liquidity. Optionally, sends all KETH accrued by the lender.Input Parameters
amount: amount of kETH to be withdrawnclaim:
true
for claiming accrued kETH
Using withdraw function
Return Parameter
Transaction details if the transaction was successful.claimKETHForLender function
Claims all of the accrued KETH for the lender and sends it to the lender’s address.Input Parameters
lender: ETH address of the lenderUsing claimKETHForLender function
Return Parameter
Transaction details if the transaction was successful.nodeOperatorDeposit function
Deposit node operator in K2 lending protocol.Input Parameters
blsPublicKey: BLS public key of the validatorpayoutRecipient: ETH address of the recipient that would receive payout
blsSignature: BLS Signature associated with the BLS public key
ecdsaSignature: ECDSA signature
Using nodeOperatorDeposit function
Return Parameter
Transaction details if the transaction was successful.batchNodeOperatorDeposit function
Batch deposit multiple node operators in K2 lending protocol.Input Parameters
blsPublicKeys: Array of BLS public keys of the validatorspayoutRecipients: Array of ETH addresses of the recipients that would receive payout
blsSignatures: Array of BLS Signatures associated with the BLS public keys ecdsaSignatures: Array of ECDSA signatures
Using batchNodeOperatorDeposit function
Return Parameter
Transaction details if the transaction was successful.nodeOperatorWithdraw function
Withdraw node operator from the K2 Lending protocol.Input Parameters
nodeOperatorAddress: ETH address of the node operatorblsPublicKey: BLS public key string
Using nodeOperatorWithdraw function
Return Parameter
Transaction details if the transaction was successful.nodeOperatorKick function
Kick node operator from the K2 Lending protocol.Input Parameters
reporterAddress: ETH address of the reporterblsPublicKey: BLS public key
Using nodeOperatorKick function
Return Parameter
Transaction details if the transaction was successful.nodeOperatorClaim function
Claim ETH earned for all the BLS public keys associated with a node operator.Input Parameters
blsPublicKeys: List of BLS public keys to claim forUsing nodeOperatorClaim function
Return Parameter
Transaction details if the transaction was successful.slash function
Slash KETH from the pool. This function can only be called by a reporter.Input Parameters
slashType: the slash type (liveness & corruption) debtor: the debtor address amount: the slash amount recipient: the recipient addressUsing slash function
Return Parameter
Transaction details if the transaction was successful.terminate function
Terminate debt positionInput Parameters
debtor: ETH address of the debtorUsing terminate function
Return Parameter
Transaction details if the transaction was successful.liquidate function
Liquidate debt position.Input Parameters
debtor: ETH address of the debtorUsing liquidate function
Return Parameter
Transaction details if the transaction was successful.topUpSlashAmount function
Top up kETH if it gets slashed.Input Parameters
debtor: debtor address in string formatamount: amount of kETH to topup
Using topUpSlashAmount function
Return Parameter
Transaction details if the transaction was successful.topUpAndTerminate function
Top up kETH if it gets slashed and terminate debt position.Input Parameters
amount: amount of kETH to topupUsing topUpAndTerminate function
Return Parameter
Transaction details if the transaction was successful.borrow function
Borrows KETH from the pool and records the debt to the debtor’s addressInput Parameters
debtPositionType: debt position typedesignatedVerifier: The designated verifier of debtor
amount: The debt principal to borrow
maxSlashableAmountPerLiveness: Maximum slashable amount per liveness
maxSlashableAmountPerCorruption: Maximum slashable amount per corruption
rstConfigParams: config params of type RSTConfigParamsT
Using borrow function
Return Parameter
Transaction details if the transaction was successful.borrowFor function
Borrows KETH from the pool for another debtor and records the debt to the debtor’s addressInput Parameters
debtor: Address of the debtor debtPositionType: debt position typedesignatedVerifier: The designated verifier of debtor
amount: The debt principal to borrow
maxSlashableAmountPerLiveness: Maximum slashable amount per liveness
maxSlashableAmountPerCorruption: Maximum slashable amount per corruption
rstConfigParams: config params of type RSTConfigParamsT
Using borrowFor function
Return Parameter
Transaction details if the transaction was successful.increaseDebt function
Increase the SBP coverage and borrow a larger amount from K2 protocol which will cancel the old SBP.Input Parameters
debtPositionType: debt position typedesignatedVerifier: The designated verifier of debtor
amount: The debt principal to borrow
maxSlashableAmountPerLiveness: Maximum slashable amount per liveness
maxSlashableAmountPerCorruption: Maximum slashable amount per corruption
resetDuration: If true, resets the duration else keeps the remaining duration of the borrow
Using increaseDebt function
Return Parameter
Transaction details if the transaction was successful.increaseDebtFor function
Increase the SBP coverage and borrow a larger amount from K2 protocol for another debtor which will cancel the old SBP.Input Parameters
debtor: Address of the debtor debtPositionType: debt position typedesignatedVerifier: The designated verifier of debtor
amount: The debt principal to borrow
maxSlashableAmountPerLiveness: Maximum slashable amount per liveness
maxSlashableAmountPerCorruption: Maximum slashable amount per corruption
resetDuration: If true, resets the duration else keeps the remaining duration of the borrow