Skip to main content

kETHStrategy sub-class

The following readme describes all the functions and their parameters exposed by the kETHStrategy class of the KETH SDK.

assetValue function

This function returns the ETH value for a given asset from the following: ETH, dETH, GiantLP, wstETH, rETH, savETH.

Input Parameters

asset: The asset contract address
balance: The asset balance

Using assetValue function

await sdk.kETHStrategy.assetValue(asset, balance);

Return Parameter

Returns the asset ETH value

assetsRatio function

This function returns the assets ratio.

Using assetsRatio function

await sdk.kETHStrategy.assetsRatio();

Return Parameter

Returns the assets ratio.

balance function

This function returns the current balance of the strategy contract for the given token.

Input Parameters

token: The token address

Using balance function

await sdk.kETHStrategy.balance(token);

Return Parameter

Returns the token balance of the strategy.

invokeSwap function

This function allows the user to invoke the swap function for a pair of tokens.

Input Parameters

swapper: The swapper contract address
tokenIn: The input token address
amountIn: The input token amount
tokenOut: The output token address
minAmountOut: The minimum output token amount
extraData: Optional extra calldata to be attached

Using invokeSwap function

await sdk.kETHStrategy.invokeSwap(swapper, tokenIn, amountIn, tokenOut, minAmountOut, extraData);

Return Parameter

Transaction details if the transaction is successful.

isHoldingAsset function

This function returns true if the given holding asset is supported, else false.

Input Parameters

asset: The asset address

Using isHoldingAsset function

await sdk.kETHStrategy.isHoldingAsset(asset);

Return Parameter

Returns true if the given holding asset is supported, else false

isUnderlyingAsset function

This function returns true if the given underlying asset is supported, else false

Input Parameters

underlying: The underlying asset address

Using isUnderlyingAsset function

await sdk.kETHStrategy.isUnderlyingAsset(underlying);

Return Parameter

Returns true if the given underlying asset is supported, else false

totalAssets function

This function returns the total assets value of strategy in ETH.

Using totalAssets function

await sdk.kETHStrategy.totalAssets();

Return Parameter

Returns the total assets value of strategy in ETH

underlyingAssets function

This function returns a list of the supported underlying assets.

Using underlyingAssets function

await sdk.kETHStrategy.underlyingAssets();

Return Parameter

Returns an array of supported underlying assets