Stake Pool Shares

Users can stake pool shares to an ERC20 Staking contract to earn rewards. The staking conract is specific to the pool that was staked to and is created by ThirdWeb.

Addresses you’ll need per pool

  • staking: Thirdweb ERC20 staking (stakes vault shares)

  • rewardToken: ERC20 paid by staking

The following code example is in typescript. These smart contract integrations can be generalized to any codebase.

Minimal ABIs

// Thirdweb StakingERC20 (stake/withdraw/claimRewards/getStakeInfo)
export const stakingErc20Abi = [
  { type:'function', name:'stake',          stateMutability:'nonpayable', inputs:[{type:'uint256','name':'amount'}], outputs:[] },
  { type:'function', name:'withdraw',       stateMutability:'nonpayable', inputs:[{type:'uint256','name':'amount'}], outputs:[] },
  { type:'function', name:'claimRewards',   stateMutability:'nonpayable', inputs:[], outputs:[] },
  // returns (stakedAmount, claimableRewards)
  { type:'function', name:'getStakeInfo',   stateMutability:'view', inputs:[{type:'address','name':'staker'}], outputs:[{type:'uint256'},{type:'uint256'}]},
] as const;

STAKE (approve shares → staking.stake)

User stakes vault shares (the ERC20 share token is the same vault address).

READS for UI: balances

Staked in Thirdweb staking (shares held on contract for user)

Last updated