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

@avareum/farm-info

v0.29.0

Published

Decode Defi Farm for human readable.

Downloads

4

Readme

DeFarm

Decode Defi Farm for human readable.

Features

  • [x] ALPACA: fetchLendsBySymbols
  • [x] CAKE: fetchFarmsWithAPRBySymbols
  • [x] CAKE: fetchTokenUSDPricesBySymbols
  • [x] ALPACA: USER Get user's active position with addition info.
  • [x] CAKE: USER fetchPoolReward

TODO

  • [x] ALPACA: USER Get account tx to get investment information.

Installation

npm

Development

npm dev

Test

npm test
npm test-dev

Release

npm login
npm run release

Example: USD Price

CAKE price from pancakeswap

import { pancakeswap } from "@avareum/farm-info";
const results = await pancakeswap.fetchTokenUSDPricesBySymbols(["CAKE"]);
console.log(results);

ALPACA, ETH, BNB prices from pancakeswap

import { pancakeswap } from "@avareum/farm-info";
const results = await pancakeswap.fetchTokenUSDPricesBySymbols([
  "ALPACA",
  "ETH",
  "BNB",
]);
console.log(results);

ibALPACA price from pancakeswap

import { alpaca } from "@avareum/farm-info";

// It's a good idea to check for supported symbols before calling fetchTokenUSDPricesBySymbols
const supportedSymbols = alpaca.getSupportedUSDSymbols();
console.log(supportedSymbols);

// Better use to fetch only supported `ibToken` prices
const [ibALPACA] = await alpaca.fetchTokenUSDPricesBySymbols(["ibALPACA"]);
console.log(results);

Example: Farm's info

ALPACA lend info w/ price

import { alpaca } from "@avareum/farm-info";
const results = await alpaca.fetchLendsBySymbols(["ALPACA"]);
console.log(results);

CAKE-BNB pool info w/ price + APR

import { pancakeswap } from "@avareum/farm-info";
const results = await pancakeswap.fetchFarmsWithAPRBySymbols(["CAKE-BNB LP"]);
console.log(results);

Example: User's info

Get user balance

import { alpaca } from "@avareum/farm-info";
const balances = await alpaca.fetchUserBalance(
  "0x8155430e4860e791aeddb43e4764d15de7e0def1"
);
console.log(results);

Get user related farm info

import { alpaca } from "@avareum/farm-info";
const lends = await alpaca.fetchUserLends(
  "0x8155430e4860e791aeddb43e4764d15de7e0def1"
);
const stakes = await alpaca.fetchUserStakes(
  "0x8155430e4860e791aeddb43e4764d15de7e0def1"
);

TODO

  • [ ] fix wrong symbol name which grab from event.
  • [ ] Support addCollateral with debt.
  • [ ] summary stake, lend.
  • [ ] Define liquidate position state.
  • [ ] Add all kill related support.
  • [ ] Use 0x0002e89a801bf95a131fbbbdfd3097fa84809d7c for stress kill test.
  • [ ] kill in action https://bscscan.com/tx/0xc14748b07056596783c7054dc1b345283aa4e39846ba13fb7084621b7f37f1f8
  • [ ] kill list https://explorer.bitquery.io/bsc/txs/calls?contract=0xd7d069493685a581d27824fc46eda46b7efc0063&method=d29a0025
  • [ ] add AUSD support.
  • [ ] more unit test!