Skip to main content

Interacting with kETH protocol contracts

Below you can find the kETH protocol contracts and their addresses for the given networks

Mainnet (https://dapp.getketh.com/)

ContractAddress
dETH Vault0x4c7aF9BdDac5bD3bee9cd2Aa2FeEeeE7610f5a6B
kETH Vault0xE0C28A5A2da3920946E8Bf821F61F7BEA311048b
kETH Strategy0xa060a5F83Db8bf08b45Cf56Db370c9383b7B895C
BSN0x534D1F5E617e0f72A6b06a04Aa599839AF776A5e
BSN Farming0x5CeCfAf8f8c2983A3336adbe836aF39192a72895

Goerli (https://goerli.getketh.com/)

ContractAddress
dETH Vault0x3564A47E2f1b8450f50b51a023A8427Ae7B62Eb7
kETH Vault0x509c0a85e5e23bAB829B441Ed5390452dEf827e4
kETH Strategy0x952a868c89b38F6a15A0de38d80f77e225f4cfe7
Test BSN0x35F75C280964BCA465623f5F34B10373553E7609
BSN Farming0xc861fde48246a4b78c90a0d2b9d4907873a3100a

Interacting with the contracts

You can interact with the above contracts by creating an instance using ethers.

Install and import ethers

npm i ethers

Importing ethers

const {ethers} = reqwuire('ethers');

Copy and import the required ABIs

The ABIs for all the above contracts can be found here. Copy the ABI for the required contracts into your project directory and import it into your script. For example:

const abi = require('./KETHStrategy.json')

Create the signer and provider instance

This guide uses version 6 of the ethers.js library and it is recommended to use this library to create a provider and a signer instance, required for signing the transaction. You can use any provider API that you want from this list. For this tutorial, Infura is used.

const provider = new ethers.InfuraProvider(
"goerli",
INFURA_PROJECT_ID,
INFURA_PROJECT_SECRET,
);
const signer = new ethers.Wallet(PRIV_KEY, provider);

Creating the contract instance

Create the required contract instance using ethers as follows

const contract = new ethers.Contract(
<CONTRACT_ADDRESS>,
abi,
signer
)

Now you can use the above created instance to interact with all public and external functions in the contract.