dETHVault sub-class
The following readme describes all the functions and their parameters exposed by the dETHVault
class of the KETH SDK.
amountToShare function
This function takes the ETH/dETH amount as the input and converts it to the equivalent LP Token amount.
Input Parameters
amount: The ETH/dETH amount
Using amountToShare function
await sdk.dETHVault.amountToShare(amount);
Return Parameter
Returns the LP Token amount
deposit function
This function allows the user to deposit dETH and get LP Tokens in return.
Input Parameters
amount: Amount of dETH to be deposited
recipient: The recipient address
Using deposit function
await sdk.dETHVault.deposit(amount, recipient);
Return Parameter
Transaction details if the transaction is successful.
reserves function
This function returns the reserve value of the given token.
Input Parameters
token: The token address
Using reserves function
await sdk.dETHVault.reserves(token);
Return Parameter
Returns the reserve value of the token
shareToAmount function
This function takes the LP Token amount as the input and converts it to the equivalent ETH/dETH amount.
Input Parameters
share: The LP Token amount
Using shareToAmount function
await sdk.dETHVault.shareToAmount(share);
Return Parameter
Returns the ETH/dETH amount
swapETHToDETH function
This function allows the user to deposit ETH and get dETH in return.
Input Parameters
recipient: The recipient address value: The ETH value to be deposited
Using swapETHToDETH function
await sdk.dETHVault.swapETHToDETH(recipient, value);
Return Parameter
Transaction details if the transaction is successful.
totalAssets function
This function returns the total ETH/dETH balance of the vault.
Using totalAssets function
await sdk.dETHVault.totalAssets();
Return Parameter
Returns the total ETH/dETH balance of the vault
withdrawToDETH function
This function allows the user to burn their LP Tokens and get their deposited dETH back.
Input Parameters
share: The LP Token amount to be burnt
recipient: The recipient address
Using withdrawToDETH function
await sdk.dETHVault.withdrawToDETH(share, recipient);
Return Parameter
Transaction details if the transaction is successful.
withdrawToETH function
This function allows the user to burn their LP Tokens and get their deposited ETH back.
Input Parameters
share: The LP Token amount to be burnt
recipient: The recipient address
Using withdrawToETH function
await sdk.dETHVault.withdrawToETH(share, recipient);
Return Parameter
Transaction details if the transaction is successful.