The following readme describes all the necessary functions and their parameters exposed by the rstModule class of the K2 SDK.

getK2LendingContract function

Get address of the K2 lending contract.

Using getK2LendingContract function

await sdk.rstModule.getK2LendingContract();

Return Parameter

Returns address of K2 Lending contract

getImplementationContract function

Address of the implementation contract that will be cloned (minimal proxy standard).

Using getImplementationContract function

await sdk.rstModule.getImplementationContract();

Return Parameter

Returns address of implementation contract

isRST function

Check if a contract is RST or not.

Input Parameters

contractAddress: Address of contract

Using isRST function

await sdk.rstModule.isRST(contractAddress);

Return Parameter

Returns true if valid RST contract, false otherwise.

sbpToRST function

Get the RST token associated with an SBP(Slashable borrow position) index.

Input Parameters

sbpIndex: SBP index in string

Using sbpToRST function

await sdk.rstModule.sbpToRST(sbpIndex);

Return Parameter

Returns RST token address.

sbpOwnerToRST function

RST address deployed by the debtor (SBP owner).

Input Parameters

debtorAddress: Address of debtor

Using sbpOwnerToRST function

await sdk.rstModule.sbpOwnerToRST(debtorAddress);

Return Parameter

Returns RST token address.

sbpLabel function

Get the label configured by the SBP owner for their SBP index.

Input Parameters

sbpIndex: SBP index in string

Using sbpLabel function

await sdk.rstModule.sbpLabel(sbpIndex);

Return Parameter

Returns SBP label in string.

deployRST function

Deploy RST. RST can only be deployed at the time of creating the SBP.

Input Parameters

debtorAddress: Address of debtor in string
recipientAddress: Address of the account (in string) that will receive 90% of the tokens minted
dao: DAO address in string that will hold back 10% to ensure that it maintains incentives for native delegation
k2Incentives: Address in string
percentageContributionToIncentives: string
amount: Total supply that will be minted where the upper bound is the SBP principle in string
symbol: The RST token symbol used when deploying the ERC20 cloneable token in string

Using deployRST function

await sdk.rstModule.deployRST(
  debtorAddress,
  recipientAddress,
  dao,
  k2Incentives,
  percentageContributionToIncentives,
  amount,
  symbol
);

Return Parameter

Address of RST deployed.

updateRSTLabel function

Updated label of SBP index.

Input Parameters

sbpIndex: SBP index in string
label: new SBP label in string

Using updateRSTLabel function

await sdk.rstModule.updateRSTLabel(sbpIndex, label);

Return Parameter

Transaction hash.