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

rewards-farmer

v1.0.5

Published

open-source factory for managing rewards tokens

Downloads

35

Readme

rewards-farmer

Rewards Farmer is an open-source proxy factory that can be used with your DeFi wrapper token to manage the rewards and governance tokens that your users accrue.

WARNING: This code has not yet been audited. Please be careful and use at your own risk.

Installation

$ npm install @openzeppelin/contracts

Contracts

FarmerFactory.sol

  • uses OpenZeppelin's ProxyFactory contract
  • deployProxy deploys a clone of logic contract for a user and links their address to the proxy
  • mapping (address => address) public farmerProxy mapping of user address to the proxy address
  • logicContract address that the farmer proxy contracts point to

Farmer.sol

  • sets FarmerFactory contract as owner to prevent direct function calls to Farmer

Architecture

img

How to use

  1. Create your own TokenFarmer contract that inherits from the Farmer contract. Your TokenFarmer contract is used as the logic contract for the proxies that your wrapper token contract will deploy. These proxies are used to mint, store, transfer and redeem your users' interest bearing tokens (e.g., cDAI) all while at the same time accumulating their corresponding rewards or governance tokens (e.g., COMP).

  2. Then, have your wrapper token contract inherit from the FarmerFactory contract. Your wrapper token contract can now be used as a factory contract for generating TokenFarmer proxies on behalf of your users.

Example

TokenFarmerFactory

TokenFarmer

Testing

  1. In terminal, run forked mainnet:
ganache-cli -f https://mainnet.infura.io/v3/<insert projectId> --unlock "0xc0a47dFe034B400B47bDaD5FecDa2621de6c4d95" --unlock "0x6B175474E89094C44Da98b954EedeAC495271d0F" --unlock "0x98CC3BD6Af1880fcfDa17ac477B2F612980e5e33" --unlock "0x5d3a536E4D6DbD6114cc1Ead35777bAB948E3643" --unlock "0x897607ab556177b0e0938541073ac1e01c55e483" --unlock "0x076c95c6cd2eb823acc6347fdf5b3dd9b83511e4" --unlock "0xcae687969d3a6c4649d114b1c768d5b1deae547b" --unlock "0xd89b6d5228672ec03ab5929d625e373b4f1f25f3"
  1. In another tab, run: truffle test --network mainlocal