LogoLogo
  • Introduction
    • Get started
  • Kiln Products
    • Overview
    • 🧱Validators
      • ⛓️Protocols
        • Algorand (ALGO)
        • Aptos (APT)
        • Avalanche (AVAX)
        • Babylon (BABY)
        • Cardano (ADA)
        • Celestia (TIA)
        • CoreChain (CORE)
        • Cosmos (ATOM)
        • Cronos (CRO)
        • DyDx (DYDX)
        • Ethereum (ETH)
        • Eigenlayer (EIGEN)
        • Fetch.ai (FET)
        • Flare (FLR)
        • Harmony (ONE)
        • Injective (INJ)
        • Iota (IOTA)
        • Kava (KAVA)
        • Kusama (KSM)
        • Mantra (OM)
        • MultiversX (EGLD)
        • Near (NEAR)
        • Oasis (ROSE)
        • Osmosis (OSMO)
        • Peaq (PEAQ)
        • Polkadot (DOT)
        • Polygon (POL - ex MATIC)
        • Sei (SEI)
        • Solana (SOL)
        • Stacks (STX)
        • Starknet (STRK)
        • Story(IP)
        • Sui (SUI)
        • Symbiotic (SYM)
        • Tezos (XTZ)
        • The Open Network (TON)
        • Tron (TRX)
        • Zetachain (ZETA)
    • 🎆Connect
      • Accessing Kiln Connect
      • API specs
      • Postman Demo
      • SDK
        • Getting started
        • How to find Kiln's validators
        • Upgrade guide from v2 to v3
      • Tutorials
        • SOL - Tag a stake
        • DYDX - How to bridge your rewards
      • Kiln Connect FAQs
    • 🚀Dashboard
      • Architecture
      • Staking
        • Cardano (ADA)
        • Celestia (TIA)
        • Cosmos (ATOM)
        • Cronos (CRO)
        • DYDX (DYDX)
        • Ethereum (ETH)
          • Native EigenLayer Restaking
          • Deposit into compounding validators
          • Convert skimming validators to compounding validators
        • Fetch.ai (FET)
        • Injective (INJ)
        • Kava (KAVA)
        • Kusama (KSM)
        • Mantra (OM)
        • Near (NEAR)
        • Osmosis (OSMO)
        • Polkadot (DOT)
        • Polygon (POL)
        • Solana (SOL)
        • Tezos (XTZ)
        • The Open Network (TON)
        • TRON (TRX)
        • ZetaChain (ZETA)
      • Reporting
        • Cardano (ADA)
        • Celestia (TIA)
        • Cosmos (ATOM)
        • Cronos (CRO)
        • DYDX (DYDX)
        • Ethereum (ETH)
        • Fetch.ai (FET)
        • Injective (INJ)
        • Kava (KAVA)
        • Kusama (KSM)
        • Mantra (OM)
        • Near (NEAR)
        • Osmosis (OSMO)
        • Polkadot (DOT)
        • Polygon (POL)
        • Solana (SOL)
        • Tezos (XTZ)
        • The Open Network (TON)
        • Tron (TRX)
        • ZetaChain (ZETA)
      • Unstaking
        • Cardano (ADA)
        • Celestia (TIA)
        • Cosmos (ATOM)
        • Cronos (CRO)
        • DYDX (DYDX)
        • Ethereum (ETH)
          • Native EigenLayer Withdraw Flow
          • Partial withdraw liquidity
        • Fetch.ai (FET)
        • Injective (INJ)
        • Kava (KAVA)
        • Kusama (KSM)
        • Mantra (OM)
        • Near (NEAR)
        • Osmosis (OSMO)
        • Polkadot (DOT)
        • Polygon (POL)
        • Solana (SOL)
          • Deactivate
          • Merge
          • Split
          • Withdraw
        • Tezos (XTZ)
        • Tron (TRX)
        • The Open Network (TON)
        • ZetaChain (ZETA)
      • Import stakes
      • Move stakes
      • Invite a user to your organization
      • Troubleshooting
      • 🎓Tutorials
        • Cosmos Chains - Auto-compound a stake
      • Dashboard FAQs
    • 📥dApp
      • ETH staking
      • EigenLayer
        • Operator delegation
        • Native restaking
        • Liquid restaking
      • 🔒Security
      • Kiln dApp FAQ
    • ⛓️Onchain
      • 🙋‍♀️Dedicated Validators
        • Key concepts
          • Deposit Flow
          • Rewards Management
          • Unstaking
        • How to integrate
          • 1. Contract Interactions
          • 2. Administration
      • 🤽‍♂️Pooled Staking
        • Key concepts
          • Staking Positions
          • Oracle Reports
          • Exit & Withdrawal
        • How to integrate
          • 🐎Getting Started
          • 🏗️Architecture overview
          • 😊User experience
          • 📃Integration contract
          • ⛑️Contract governance
          • ℹ️Contract ABI
          • 📥Using TheGraph
          • 🥩Staking Interactions
            • Staking
            • Rewards
            • Unstaking & Withdrawals
      • 🎡Tokenized Validators
      • 🎩Node Operators: how to integrate
        • Dedicated Validators (v1)
          • Manage Validators
        • Pooled Staking
          • 1. Using TheGraph for Setup
          • 2. Deploying vPool
          • 3. Key Provisioning in vFactory
          • 4. Oracle Daemon
          • 5. Depositing via Integration Contracts
          • 6. Exit Daemon
          • 7. Deploy Integration Contract (optional)
      • 🔓Security
        • Staking Risks
        • Audits & Bug Bounties
        • Business Continuity
        • Source code
    • 💰DeFi
      • 🦋Morpho via Kiln DeFi
      • 💻How to integrate?
        • Smart contract interactions
        • Governance
        • Reporting data
        • Administration
        • Supported DeFi Protocols
        • Additional Rewards Management
      • 🔓Security
        • Risks
        • Audits & Bug Bounty
        • Pause
        • Source code
        • Compliance Features
      • Kiln DeFi FAQ
    • 🪄Widget
      • 🧑‍🎨Customize - Widget Editor
      • ☄️Integrate - No/Low Code
    • 🛠️More Tools
      • ETH Batch Deposit Contract
      • Safe CD
  • Integrations
    • 🔭Plan your integration
    • 🔌Integrate Kiln products
    • 📱Wallets
      • Stake from Ledger Live
        • Direct Staking
        • Using Kiln Widget
          • DeFi Lending in Ledger Live
        • Using Kiln dApp
          • Dedicated Validators
          • Pooled Staking
          • EigenLayer Restaking
      • Stake from Safe{Wallet}
        • How to stake ETH on Safe & FAQ
        • DeFi Lending in Safe{Wallet}
        • Using Kiln dApp
      • Stake from Squads
    • 🏢Custody platforms
      • Stake from Anchorage
      • Stake from Bitgo
      • Stake from Coinbase Custody/Prime
      • Stake from Copper
      • Stake from Cordial Systems
      • Stake from DFNS
      • Stake from Finoa
      • Stake from Fireblocks
      • Stake from Fordefi
      • Stake from Hex Safe
      • Stake from Ledger Enterprise
      • Stake from Metamask Institutional
      • Stake from Rakkar
      • Stake from Utila
  • Working with Kiln
    • ☑️Staking & DeFi Track Record
    • ✅Security & Insurances
    • ☎️Support
      • FAQs
        • Enzyme FAQ
        • EigenLayer FAQ
        • Kiln x Safe{Wallet} FAQ
        • Ledger Live FAQ
Powered by GitBook
On this page
  • Stake any amount of ETH
  • Get the amount of shares from integration contract by wallet
  • Get the current value of a user's staked position
  • Retrieving all the deposit actions of a user

Was this helpful?

Export as PDF
  1. Kiln Products
  2. Onchain
  3. Pooled Staking
  4. How to integrate
  5. Staking Interactions

Staking

Stake any amount of ETH

Used to stake any amount of ETH into the pool.

This can only be executed by calling a smart contract method:

cast send $INTEGRATION_CONTRACT_ADDRESS "stake()" --value $AMOUNT_TO_STAKE_IN_ETH

Get the amount of shares from integration contract by wallet

Used to find the amount of shares for a given wallet from the integration contract

Using the smart contract view methods

cast call $INTEGRATION_CONTRACT_ADDRESS "balanceOf(address)(uint256)" $USER_ADDRESS

Get the current value of a user's staked position

Allows you to obtain the value (in ETH) of the users current staked position

For example, consider the scenario where a user staked 12 ETH several months ago. Every time they visit your app, you want to showcase the current value of the staked position accounting for the accrued value from staking rewards over time.

You can simply query the smart contract with the users wallet.

Using the smart contract view methods

cast call $INTEGRATION_CONTRACT_ADDRESS "balanceOfUnderlying(address)(uint256)" $USER_ADDRESS

Using TheGraph queries

Query
{
  erc20(id:"INTEGRATION_CONTRACT_ADDRESS") {
    totalSupply
    totalUnderlyingSupply
    balances(where:{staker:"USER_ADDRESS"}) {
    	sharesBalance
    }
  }
}

Example query

{
  "data": {
    "erc20": {
      "totalSupply": "23608675969602594618589",
      "totalUnderlyingSupply": "23752224529858293552006",
      "balances": [
        {
          "sharesBalance": "499892147748515755"
        }
      ]
    }
  }
}
Results
{
  "data": {
    "erc20": {
      "totalSupply": "23608675969602594618589",
      "totalUnderlyingSupply": "23752224529858293552006",
      "balances": [
        {
          "sharesBalance": "499892147748515755"
        }
      ]
    }
  }
}
Calculate value
  • underlyingBalanceValue = ((sharesBalance * totalUnderlyingSupply) / totalSupply)


Retrieving all the deposit actions of a user

TheGraph queries

{
  erc20(id:"INTEGRATION_CONTRACT_ADDRESS") {
    deposits(where:{staker:"USER_ADDRESS"},orderBy:createdAt,orderDirection:desc) {
      hash
      depositAmount
      mintedShares
    }
  }
}
{
  "data": {
    "erc20": [
      {
        "deposits": [
          {
            "hash": "0xb644b754d59c3693fa12a8be796bbc31db2f922964b581603c5e020b5aebd591",
            "depositAmount": "10000000000",
            "mintedShares": "9981371152"
          },
          {
            "hash": "0xd2aa2b95f27f38e57a1cf4064110f1c5771252249b16fcf55c4d6aa74bc7340e",
            "depositAmount": "10000000000",
            "mintedShares": "9982062545"
          },
          {
            "hash": "0xf640ef3b91de25f76792debb41f2f26f0886a79f3fccb4fffff372487dac22fa",
            "depositAmount": "100000000000",
            "mintedShares": "99821696059"
          },
          {
            "hash": "0xaa212b98a0c44f57ebedc50337c24853739f07164a7681a1eb6b2fc1753e8f91",
            "depositAmount": "100000000000",
            "mintedShares": "99822049624"
          },
          {
            "hash": "0xad2ad5026fda650861ea6ab0e278e39150812fa74a623879cbb3263dd157b07c",
            "depositAmount": "100000000000",
            "mintedShares": "99822049624"
          },
          {
            "hash": "0x8a5f98769d52b05bd37ef66db8976981d67e50f7401269cf2ffd2801d583ddc1",
            "depositAmount": "100000000000",
            "mintedShares": "99822049623"
          }
        ]
      }
    ]
  }
}
PreviousStaking InteractionsNextRewards

Last updated 1 year ago

Was this helpful?

⛓️
🤽‍♂️
🥩