DeFi integration guide
Integrate Tally's staking contract into a DeFi protocol
Integrate the ERC20 Token
Smart contract audits
function getUnderlyingBalance(address user) external view returns (uint256) {
// Get the fixed LST token balance of the user
uint256 fixedTokenBalance = fixedLstContract.balanceOf(user);
// If the account has no balance, return 0
if (fixedTokenBalance == 0) return 0;
// The share scale factor is public on the FixedGovLst contract
uint256 shareScaleFactor = fixedLstContract.SHARE_SCALE_FACTOR();
// Convert the fixed LST tokens to shares by multiplying by the scale factor
uint256 userShares = fixedTokenBalance * shareScaleFactor;
// Use the rebasing LST contract's stakeForShares function
uint256 underlyingBalance = governanceLstContract.stakeForShares(userShares);
return underlyingBalance;
}Last updated
Was this helpful?

