Skip to content

GovernanceUiHelper

senamakel edited this page Jan 20, 2025 · 1 revision

Solidity API

GovernanceUiHelper

Utility contract to retrieve and format user’s staking and locking information, including APR, for front-end or off-chain access in the MAHA DAO ecosystem.

This contract fetches data from the OmnichainStakingToken contract, including reward rates, total supply, and calculates APR based on locked balances and reward rates.

omnichainStaking

contract OmnichainStakingToken omnichainStaking

The staking contract associated with MAHA DAO governance for retrieving user’s locked balances

LockedBalanceWithApr

struct LockedBalanceWithApr {
  uint256 id;
  uint256 amount;
  uint256 end;
  uint256 start;
  uint256 power;
  uint256 apr;
}

constructor

constructor(address _omnichainStakingToken) public

Constructor initializes the MahaUIHelper with the address of the OmnichainStakingToken contract.

Parameters

Name Type Description
_omnichainStakingToken address The address of the OmnichainStakingToken contract.

getLockDetails

function getLockDetails(address _userAddress) external view returns (struct GovernanceUiHelper.LockedBalanceWithApr[])

Retrieves the details of all locked balances for a specified user.

Returns an array of LockedBalanceWithApr structs with details including lock amount, APR calculation based on staking rewards, and lock duration.

Parameters

Name Type Description
_userAddress address The address of the user whose locked balances are retrieved.

Return Values

Name Type Description
[0] struct GovernanceUiHelper.LockedBalanceWithApr[] lockDetails Array of LockedBalanceWithApr structs containing lock ID, amount, start and end dates, vePower, and scaled APR.

Clone this wiki locally