npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@bgd-labs/aave-governance-ui-helpers

v3.1.5

Published

This repository saves and updates the cache for Aave governance v3, also includes helper functions connected to Aave governance UI version 3.

Downloads

254

Readme

Repository with cache and helpers for aave governance v3

This repository saves and updates the cache for Aave governance, also includes helper functions connected to Aave governance UI.

Installation like a package

npm

npm i @bgd-labs/aave-governance-ui-helpers

yarn

yarn add @bgd-labs/aave-governance-ui-helpers

Usage examples

Cache generator

    import { updateCache } from '@bgd-labs/aave-governance-ui-helpers/dist/scripts/update-cache-package.ts';

    updateCache({
      govCoreChainId: govCoreChainId,
      govCoreContractAddress: govCoreContractAddress,
    });

Gov core configs

    import { getGovCoreConfigs } from '@bgd-labs/aave-governance-ui-helpers';

    const govCoreConfigs = await getGovCoreConfigs({
      client: govCoreViemClient,
      govCoreContractAddress: govCoreAddress,
      govCoreDataHelperContractAddress: govCoreDataHelperAddress,
    });

Voting balances proofs

    import { baseSlots, AssetsBalanceSlots, Asset, getVotingProofs } from '@bgd-labs/aave-governance-ui-helpers';
    import { getVotingProofs as eGetVotingProofs } from '@bgd-labs/aave-governance-ui-helpers/dist/ether-v5';
    import { AaveV3Ethereum, AaveSafetyModule, GovernanceV3Ethereum } from '@bgd-labs/aave-address-book';

    const assets = {
        aaveAddress: AaveV3Ethereum.ASSETS.AAVE.UNDERLYING,
        aAaveAddress: AaveV3Ethereum.ASSETS.AAVE.A_TOKEN,
        stkAAVEAddress: AaveSafetyModule.STK_AAVE,
        contractAddress: GovernanceV3Ethereum.GOVERNANCE,
    }

    const assetsBalanceSlots: AssetsBalanceSlots = {
        [assets.stkAAVEAddress.toLowerCase()]: {
            ...baseSlots[Asset.STKAAVE],
        },
        [assets.aAaveAddress.toLowerCase()]: {
            ...baseSlots[Asset.AAAVE],
        },
        [assets.aaveAddress.toLowerCase()]: {
            ...baseSlots[Asset.AAVE],
        },
        [assets.contractAddress.toLowerCase()]: {
            ...baseSlots[Asset.GOVCORE],
        },
    };

    const formattedBalances = [{
        underlyingAsset: assets.aaveAddress, // address of voting asset
        value: "100", // total balance (user balance + delegated voting power) on voting block
        userBalance: "100", // should be real user balance on voting block (not current))
        isWithDelegatedPower: false, // value !== userBalance (on voting block)
    }]

    // getting balance proofs for voting viem
    const proofs = await getVotingProofs({
        client: govCoreViemClient, // viem client
        blockHash: proposal.snapshotBlockHash, // from proposal data
        balances: formattedBalances,
        address: voterAddress, // signer or representation address
        aAaveAddress: assets.aAaveAddress,
        slots: assetsBalanceSlots,
    });
    
    // getting balance proofs for voting ether js v5
    const proofsEtherJs = await eGetVotingProofs({
        provider: govCoreRPCProvider, // ether js v5 provider
        blockHash: proposal.snapshotBlockHash, // from proposal data
        balances: formattedBalances,
        address: voterAddress, // signer or representation address
        aAaveAddress: assets.aAaveAddress,
        slots: assetsBalanceSlots,
    });

How to update cache

The cache is updated automatically every 3 hours, but you can do this locally:

  • Clone project from github
  • Create an env file with network name, here is an example env

after

yarn cache:update && yarn cache:parse

License

Copyright © 2024, BGD Labs. Released under the MIT License.