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

@neverland-money/contract-helpers

v0.2.1

Published

Contract helper classes for Neverland protocol

Readme

@neverland-money/contract-helpers

Contract helper classes for interacting with Neverland protocol smart contracts. Provides a clean, typed API over raw contract calls.

Features

  • 🎯 Type-safe - Full TypeScript support with proper typing
  • 🔧 Easy to use - Simple class-based API
  • 📦 Modular - Import only what you need
  • 🧪 Testable - Easily mock for testing
  • 🔒 Safe - Built-in validation and error handling

Installation

This package is part of the Neverland utilities monorepo.

yarn install

Available Helpers

DustRewardsControllerHelper

Helper for interacting with the DustRewardsController contract that manages DUST token emissions and rewards.

Usage

Basic Setup

import { providers } from 'ethers';
import { DustRewardsControllerHelper } from '@neverland-money/contract-helpers';

// Create provider
const provider = new providers.JsonRpcProvider('https://rpc.monad.xyz');

// Create helper instance
const rewardsHelper = new DustRewardsControllerHelper({
  provider,
  contractAddress: '0x...', // DustRewardsController address
});

Get Rewards Data

// Get reward configuration for an asset
const rewardData = await rewardsHelper.getRewardsData(
  aTokenAddress,
  dustTokenAddress
);

console.log('Emissions per second:', rewardData.emissionPerSecond.toString());
console.log('Distribution end:', rewardData.distributionEnd.toNumber());

Check if Emissions are Active

const isActive = await rewardsHelper.isEmissionsActive(
  aTokenAddress,
  dustTokenAddress
);

if (isActive) {
  console.log('Rewards are currently active for this asset');
}

Get User Rewards

// Get all user rewards across multiple assets
const userRewards = await rewardsHelper.getAllUserRewards(
  [aToken1, aToken2, variableDebtToken1],
  userAddress
);

console.log('Reward tokens:', userRewards.rewardTokens);
console.log('Unclaimed amounts:', userRewards.unclaimedAmounts);

// Get user rewards for a specific reward token
const dustRewards = await rewardsHelper.getUserRewards(
  [aToken1, aToken2],
  userAddress,
  dustTokenAddress
);

console.log('Unclaimed DUST:', ethers.utils.formatUnits(dustRewards, 18));

Calculate APR

import { DustRewardsControllerHelper } from '@neverland-money/contract-helpers';

const rewardData = await rewardsHelper.getRewardsData(
  aTokenAddress,
  dustTokenAddress
);

// Calculate APR
const apr = DustRewardsControllerHelper.calculateEmissionAPR(
  rewardData.emissionPerSecond,
  dustPriceUSD, // e.g., 0.50
  totalLiquidityUSD, // e.g., 1000000
  18 // DUST decimals
);

console.log(`Emission APR: ${apr}%`);

Calculate Annual Emissions

const annualEmissions = DustRewardsControllerHelper.calculateAnnualEmissions(
  rewardData.emissionPerSecond,
  18
);

console.log(`Annual emissions: ${annualEmissions} DUST`);

Advanced: Access Raw Contract

// Get the underlying ethers contract for advanced usage
const contract = rewardsHelper.getContract();

// Call any contract method directly
const customData = await contract.someCustomMethod();

Integration with Frontend Services

Example: Refactored Service

import { providers } from 'ethers';
import { DustRewardsControllerHelper } from '@neverland-money/contract-helpers';

export class DustIncentiveService {
  private rewardsHelper: DustRewardsControllerHelper | null = null;

  async initialize(provider: providers.Provider, controllerAddress: string) {
    this.rewardsHelper = new DustRewardsControllerHelper({
      provider,
      contractAddress: controllerAddress,
    });
  }

  async fetchIncentiveData(assetAddress: string, dustTokenAddress: string) {
    if (!this.rewardsHelper) throw new Error('Not initialized');

    const rewardData = await this.rewardsHelper.getRewardsData(
      assetAddress,
      dustTokenAddress
    );

    const isActive = await this.rewardsHelper.isEmissionsActive(
      assetAddress,
      dustTokenAddress
    );

    if (!isActive) return null;

    return {
      emissionPerSecond: rewardData.emissionPerSecond.toString(),
      distributionEnd: rewardData.distributionEnd.toNumber(),
      // ... more data
    };
  }

  async getUserRewards(userAddress: string, assetAddresses: string[]) {
    if (!this.rewardsHelper) throw new Error('Not initialized');

    return await this.rewardsHelper.getAllUserRewards(
      assetAddresses,
      userAddress
    );
  }
}

API Reference

DustRewardsControllerHelper

Constructor

constructor(config: BaseContractHelperConfig)
  • config.provider - Ethers provider instance
  • config.contractAddress - DustRewardsController contract address

Methods

getRewardsData(asset, reward)

Get rewards configuration for an asset and reward token.

getAllUserRewards(assets, user)

Get all rewards for a user across multiple assets.

getUserRewards(assets, user, reward)

Get user rewards for specific assets and reward token.

getUserAccruedRewards(user, reward)

Get accrued rewards for a user and reward token.

getRewardsList()

Get list of all reward tokens configured.

getUserAssetData(user, asset, reward)

Get user's reward index and accrued amount for a specific asset.

isEmissionsActive(asset, reward, currentTimestamp?)

Check if emissions are currently active.

Static Methods

calculateAnnualEmissions(emissionPerSecond, decimals?)

Calculate annual emissions from per-second rate.

calculateEmissionAPR(emissionPerSecond, rewardPriceUSD, tvlUSD, decimals?)

Calculate APR from emissions, reward price, and TVL.

Building

yarn build

Type Checking

yarn check-types

Related Packages

  • @neverland-money/contract-types - Typed ABIs used by these helpers