Skip to content

Hooks & State ​

The frontend uses custom React hooks to interact with the blockchain and Zustand stores for global UI state.

Custom Hooks ​

Hooks are located in frontend/src/hooks/.

HookPurpose
useBribeActionsDeposit and claim bribe rewards.
useContractsContract instance helpers and read/write wrappers.
useFaucetTestnet faucet interactions.
useGaugeRewardsGauge reward claiming and APR data.
usePairsPair/pool data and token reserve helpers.
useProtocolStatsProtocol-level TVL, volume, fee, and APR statistics.
useSafeAppGnosis Safe wallet integration helpers.
useSwapSwap execution and token approval flow.
useSwapQuoteSwap amount-out and price-impact quotes.
useTokenBalanceToken balance fetching and formatting.
useTokenLogoToken logo image resolution.
useVestNFTsVoting-escrow NFT data and lock actions.
useVotingStatsVoting power and gauge-vote statistics.
useWhitelistedTokensWhitelisted token list and metadata.

State Stores ​

Stores are located in frontend/src/store/.

StorePurpose
appStoreGlobal app settings such as slippage tolerance and transaction deadlines.
tokenStoreSelected tokens, token lists, and user favorites.
txStorePending transaction state and recent history.

Data Flow ​

  1. The user connects their wallet via the RainbowKit provider.
  2. Hooks read on-chain data through viem/wagmi contract calls.
  3. Stores hold global UI state and coordinate between components.
  4. Transaction status is tracked in txStore and reflected in the UI.

ABIs ​

Contract ABIs used by the hooks are in frontend/src/lib/abi/ as JSON files. The hooks import these ABIs along with deployed addresses from frontend/src/lib/contracts.ts.

Released under the GNU AGPL v3 License.