Skip to content

elkfinance/faas

Repository files navigation

FaaS (Farm as a Service) Open in Gitpod Github Actions Github Actions Hardhat

FaaS (Farm as a Service) is a smart contract-based project that allows users to create their own FarmingRewards contracts to distribute rewards to liquidity providers. This repository contains the Solidity contracts, tests, and necessary scripts for the FaaS system.

This project was built with hardhat.

Table of Contents

Features

  • Create FarmingRewards contracts for distributing rewards to liquidity providers
  • Permissioned FarmingRewards contracts for added security and control
  • Fee collection for creating new FarmingRewards contracts
  • Integration with ElkFinance's ecosystem

Architecture

FaaS is composed of several components, including staking/farming contracts that reward liquidity providers, staking strategies that implement a universal interface to different kinds of staking tokens, staking/farming managers that make it easy for users to interact with different farms, and factory contracts that facilitate the creation of new farms.

  • IStakingRewards -> StakingRewards, which comes in different flavors:
    • StakingRewardsWithILP: support impermanent loss coverage payments for v2 LPs
    • ElkSingeStakingRewards: the final contract for single staking
    • ElkV2FarmingRewards: the final contract for farming with v2 LP
    • ElkV3FarmingRewards: the final contract for farming with v3 LP
  • IStakingStrategy -> StakingStrategy, which includes the following subcontracts:
    • ERC20StakingStrategy: supports staking arbitrary ERC20 tokens
    • ERC20StakingStrategy: supports staking arbitrary ERC20 tokens and deposit/withdrawal fees
    • ERC721StakingStrategy: supports staking arbitrary ERC721 tokens
    • ElkV2StakingStrategy: supports staking v2 LPs
    • ElkV3StakingStrategy: supports staking v3 LPs
  • Managers:
    • IStakeManager -> StakeManager: manages single stake
    • IElkV2FarmManager -> ElkV2FarmManager: manages v2 farms
    • IElkV3FarmManager -> ElkV3FarmManager: manages v3 farms
  • Factories:
    • IStakeFactory -> StakeFactory: creates single stake
    • IElkV2FarmFactory -> ElkV2FarmFactory: creates v2 farms
    • IElkV3FarmFactory -> ElkV3FarmFactory: creates v3 farms

Getting Started

Follow these instructions to set up the FaaS repository on your local machine.

Prerequisites

  • Node.js and npm (Node Package Manager) installed on your system. You can download Node.js from https://nodejs.org/.

Installation

  1. Clone the repository to your local machine:
git clone https://github.com/elkfinance/faas
  1. Navigate to the project folder:
cd faas
  1. Install the project dependencies:
npm install

Running Tests

  1. Run the tests:
npm run test

Usage

The FaaS system is comprised of two main contracts: "ElkFarmFactory" (located at ./contracts/ElkFarmFactory.sol) and "FarmingRewards" (located at ./contracts/FarmingRewards.sol). The ElkFarmFactory contract is the main contract that users interact with to create new FarmingRewards contracts. The FarmingRewards contract is the contract that distributes rewards to liquidity providers.

Authors

License

See included LICENSE.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published