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/)
Contract | Address |
---|---|
dETH Vault | 0x4c7aF9BdDac5bD3bee9cd2Aa2FeEeeE7610f5a6B |
kETH Vault | 0xE0C28A5A2da3920946E8Bf821F61F7BEA311048b |
kETH Strategy | 0xa060a5F83Db8bf08b45Cf56Db370c9383b7B895C |
BSN | 0x534D1F5E617e0f72A6b06a04Aa599839AF776A5e |
BSN Farming | 0x5CeCfAf8f8c2983A3336adbe836aF39192a72895 |
Goerli (https://goerli.getketh.com/)
Contract | Address |
---|---|
dETH Vault | 0x3564A47E2f1b8450f50b51a023A8427Ae7B62Eb7 |
kETH Vault | 0x509c0a85e5e23bAB829B441Ed5390452dEf827e4 |
kETH Strategy | 0x952a868c89b38F6a15A0de38d80f77e225f4cfe7 |
Test BSN | 0x35F75C280964BCA465623f5F34B10373553E7609 |
BSN Farming | 0xc861fde48246a4b78c90a0d2b9d4907873a3100a |
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.