Skip to main content

Tutorial: Swapping ETH for dETH in kETH Protocol

ETH based kETH Strategy

kETH optimizes ETH earning against a benchmark rate.

A common strategy is for users to deposit ETH into kETH in order to yield at the highest rate at the market. In order to achieve this, kETH will re-market ETH and other LSTs in order to offer the best ETH earnings for kETH users.

One strategy is to have ETH remarketed via a strategy that acquires dETH from the dETH vault, a smart contract part of Blockswap’s kETH protocol.

Smart contracts

The Blockswap kETH Strategy contract can be found at:

https://etherscan.io/address/0xa060a5F83Db8bf08b45Cf56Db370c9383b7B895C

The Blockswap dETH vault contract can be found at:

https://etherscan.io/address/0x4c7aF9BdDac5bD3bee9cd2Aa2FeEeeE7610f5a6B

Strategy

The strategy is simple: if there is savETH or dETH in the dETH vault contract, there is an ability to boost the yield of your ETH by depositing ETH into the kETH strategy contract (via kETH UI) and then swapping that ETH to dETH.

Swapping

After depositing ETH into kETH, how do you swap ETH into dETH to boost kETH earnings? Invoke a swap on the strategy contract!

ABI required for this:

[{
"inputs": [
{
"internalType": "address",
"name": "_swapper",
"type": "address"
},
{
"internalType": "address",
"name": "_tokenIn",
"type": "address"
},
{
"internalType": "uint256",
"name": "_amountIn",
"type": "uint256"
},
{
"internalType": "address",
"name": "_tokenOut",
"type": "address"
},
{
"internalType": "uint256",
"name": "_minAmountOut",
"type": "uint256"
},
{
"internalType": "bytes",
"name": "_extraData",
"type": "bytes"
}
],
"name": "invokeSwap",
"outputs": [
{
"internalType": "uint256",
"name": "amountOut",
"type": "uint256"
}
],
"stateMutability": "nonpayable",
"type": "function"
}]

Parameters required for the transaction:

  • Swapper address: 0x9a0F65f1c2Ea92Da82Ef070ab947862B8799C103
  • Token input (ETH): 0x0000000000000000000000000000000000000000
  • Amount in: Total ETH held by strategy in WEI
  • Token Out (dETH): 0x3d1E5Cf16077F349e999d6b21A4f646e83Cd90c5
  • Min amount out: 0 (Zero)
  • Extra data: Buffer.from("") (Empty)

Invoking this transaction on the kETH strategy contract (0xa060a5F83Db8bf08b45Cf56Db370c9383b7B895C) will start boosting the kETH earnings for kETH token holders.

Happy swapping!