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 🙏

© 2026 – Pkg Stats / Ryan Hefner

kupka-contracts

v0.1.3

Published

Typed ethers v6 SDK for Kupka CharityVaultFactory and CharityAaveVault

Readme

kupka-contracts

Typed ethers v6 SDK for Kupka charity vaults.

Generated TypeChain bindings for:

  • CharityVaultFactory — deploys charity vaults
  • CharityAaveVault — ERC-4626 vault that supplies to Aave V3 and donates yield

Users deposit assets, keep their principal, and yield is donated to a charity wallet.

Install

npm install kupka-contracts ethers

Requires ethers v6. Dual-published as ESM (import) and CommonJS (require), so NestJS, Jest, and node dist/main can load it without transforming node_modules.

| Loader | Entry | | --- | --- | | import … from 'kupka-contracts' | dist/index.js (ESM) | | require('kupka-contracts') | dist/index.cjs (CJS) | | TypeScript | dist/index.d.ts |

NestJS / Jest CJS consumers do not need transformIgnorePatterns for this package.

Quick start

import { JsonRpcProvider, Wallet } from "ethers";
import {
  CharityVaultFactory__factory,
  CharityAaveVault__factory,
} from "kupka-contracts";

const provider = new JsonRpcProvider(process.env.RPC_URL);
const signer = new Wallet(process.env.PRIVATE_KEY!, provider);

const factory = CharityVaultFactory__factory.connect(
  "0xYourFactoryAddress",
  signer
);

const vaultAddress = await factory.createVault(
  "0xPoolAddressesProvider",
  "0xAsset", // e.g. USDC
  "0xCharityWallet"
);

const vault = CharityAaveVault__factory.connect(vaultAddress, signer);

await vault.deposit(amount, signer.address);
await vault.donateYield();
await vault.withdraw(amount, signer.address, signer.address);

Read-only (no wallet):

const factory = CharityVaultFactory__factory.connect(factoryAddress, provider);
const vault = CharityAaveVault__factory.connect(vaultAddress, provider);

const charity = await vault.charityWallet();
const principal = await vault.totalPrincipal();
const donated = await vault.totalDonated();

Deployments

| Network | Factory | Assets | | ------- | ------------------------------------------------------------------------------------------------------------------------------------ | ---------- | | Sepolia | [0xA19e4198d310639130f51e6aE7B5cA5722fA1F2b](https://sepolia.etherscan.io/address/0xA19e4198d310639130f51e6aE7B5cA5722fA1F2b#code) | EURS, USDC |

const SEPOLIA_FACTORY = "0xA19e4198d310639130f51e6aE7B5cA5722fA1F2b";
const factory = CharityVaultFactory__factory.connect(SEPOLIA_FACTORY, provider);

Exports

| Export | Kind | Use | | ------------------------------ | ------------ | -------------------------- | | CharityVaultFactory | type | Typed factory contract | | CharityVaultFactory__factory | class | connect(address, runner) | | CharityAaveVault | type | Typed vault contract | | CharityAaveVault__factory | class | connect(address, runner) | | IERC20Minimal / __factory | type / class | Minimal ERC-20 | | factories | namespace | All factories |

ABIs are on the factory classes:

import { CharityAaveVault__factory } from "kupka-contracts";

CharityAaveVault__factory.abi;

Vault API

The vault is ERC-4626. Common methods:

vault.deposit(assets, receiver);
vault.mint(shares, receiver);
vault.withdraw(assets, receiver, owner);
vault.redeem(shares, receiver, owner);
vault.donateYield();
vault.totalAssets();
vault.totalPrincipal();
vault.totalDonated();
vault.charityWallet();
vault.asset();

Withdrawals are limited to principal. Yield is donated via donateYield(). The charity wallet is immutable.

Factory API

factory.createVault(poolAddressesProvider, asset, charityWallet);
factory.isAssetSupported(poolAddressesProvider, asset);
factory.getAToken(poolAddressesProvider, asset);

Events

CharityAaveVault

| Event | When | Arguments | | ---------------------- | ------------------------------------------ | ------------------------------------------------------------------------------- | | YieldDonated | donateYield() sends yield to the charity | user (indexed, caller), amount | | Deposit | deposit() / mint() | sender (indexed), owner (indexed), assets, shares | | Withdraw | withdraw() / redeem() | sender (indexed), receiver (indexed), owner (indexed), assets, shares | | Transfer | vault shares move (including mint/burn) | from (indexed), to (indexed), value | | Approval | approve() / allowance change | owner (indexed), spender (indexed), value | | OwnershipTransferred | constructor / transferOwnership() | previousOwner (indexed), newOwner (indexed) |

YieldDonated is defined on the vault. Deposit and Withdraw come from ERC-4626. Transfer and Approval come from ERC-20. OwnershipTransferred comes from Ownable.

vault.on(vault.filters.YieldDonated(), (user, amount) => {
  console.log({ user, amount });
});

vault.on(vault.filters.Deposit(), (sender, owner, assets, shares) => {
  console.log({ sender, owner, assets, shares });
});

vault.on(vault.filters.Withdraw(), (sender, receiver, owner, assets, shares) => {
  console.log({ sender, receiver, owner, assets, shares });
});

vault.on(vault.filters.Transfer(), (from, to, value) => {
  console.log({ from, to, value });
});

vault.on(vault.filters.Approval(), (owner, spender, value) => {
  console.log({ owner, spender, value });
});

vault.on(vault.filters.OwnershipTransferred(), (previousOwner, newOwner) => {
  console.log({ previousOwner, newOwner });
});

Filter by indexed fields:

vault.filters.YieldDonated(userAddress);
vault.filters.Deposit(null, receiverAddress);
vault.filters.Withdraw(null, null, ownerAddress);
vault.filters.Transfer(fromAddress, toAddress);

Historical logs:

const donations = await vault.queryFilter(vault.filters.YieldDonated(), fromBlock);
for (const log of donations) {
  const { user, amount } = log.args;
}

CharityVaultFactory

| Event | When | Arguments | | ---------------------- | ----------------------------------- | ------------------------------------------------------------------------------------- | | VaultCreated | createVault() | vaultAddress (indexed), creator (indexed), charityWallet (indexed), timestamp | | OwnershipTransferred | constructor / transferOwnership() | previousOwner (indexed), newOwner (indexed) |

factory.on(
  factory.filters.VaultCreated(),
  (vaultAddress, creator, charityWallet, timestamp) => {
    console.log({ vaultAddress, creator, charityWallet, timestamp });
  }
);

factory.on(
  factory.filters.OwnershipTransferred(),
  (previousOwner, newOwner) => {
    console.log({ previousOwner, newOwner });
  }
);

Filter and query:

factory.filters.VaultCreated(null, creatorAddress);
factory.filters.VaultCreated(null, null, charityWallet);

const created = await factory.queryFilter(factory.filters.VaultCreated(), fromBlock);

Development (this repo)

This repository also contains the Solidity sources and Hardhat scripts. SDK consumers do not need them.

yarn install
yarn build

yarn build compiles contracts, generates TypeChain types, and emits dist/.

License

MIT