All Projects → farm-army → farm-army-backend

farm-army / farm-army-backend

Licence: MIT License
Track your farming and pool performance on the Binance Smart Chain, Polygon, Fantom, KuCoin Community Chain, Harmony, Celo - https://farm.army - nodejs backend

Programming Languages

javascript
184084 projects - #8 most used programming language
typescript
32286 projects

Projects that are alternatives of or similar to farm-army-backend

uniswap-arbitrage-flash-swap
Uniswap flash swap arbitrage solidity contracts
Stars: ✭ 341 (+296.51%)
Mutual labels:  smart-contracts, polygon, bsc, binance, binance-smart-chain
Bogged-Token-List
Multichain token lists by Bogged Finance
Stars: ✭ 106 (+23.26%)
Mutual labels:  polygon, bsc, ftm, matic
Rabby
The game-changing wallet for Ethereum and all EVM chains
Stars: ✭ 562 (+553.49%)
Mutual labels:  polygon, bsc, fantom, celo
nft-collection-scaffold
Production-ready code for an NFT Collection sale and minting on Ethereum, Polygon, Arbitrum or Binance Smart Chain
Stars: ✭ 53 (-38.37%)
Mutual labels:  polygon, matic, binance-smart-chain
typescript-eth-starter
🔌 Ethereum Dapp Basic Typescript Starter
Stars: ✭ 125 (+45.35%)
Mutual labels:  smart-contracts, polygon, matic
bscscan-python
The most popular asynchronous Python API for BscScan (Binance Smart Chain Explorer), available via PyPI.
Stars: ✭ 260 (+202.33%)
Mutual labels:  bsc, binance, binance-smart-chain
poly-flash
Flashloan on Polygon
Stars: ✭ 233 (+170.93%)
Mutual labels:  polygon, bsc, matic
CryptoLogos
Hundreds of crypto logos simply named by their normalized contract address
Stars: ✭ 14 (-83.72%)
Mutual labels:  polygon, bsc, fantom
awesome-defi
Curated list of awesome DeFi protocols, dapps, wallets and other resources
Stars: ✭ 36 (-58.14%)
Mutual labels:  harmony, bsc, binance
awesome-list-rpc-nodes-providers
A curated list of awesome Node providers and public PRC endpoints for Ethereum, BSC, xDAI, Fantom, Avalanche and more :)
Stars: ✭ 39 (-54.65%)
Mutual labels:  polygon, bsc, fantom
cryptodiversify
Automatically check your portfolio on the Binance exchange and advice you on rebalancing your portfolio into the top 20 cryptocurrencies by market capitalization
Stars: ✭ 43 (-50%)
Mutual labels:  portfolio, binance
Nescience-Indexing-CLI
Nescience Software & Capital Rebalancing Tool
Stars: ✭ 26 (-69.77%)
Mutual labels:  binance, kucoin
PancakeSwapPredictionBot
PancakeSwap V2 Prediction Bot With Machine Learning | Automated Strategy, Auto Betting, Auto Claim
Stars: ✭ 21 (-75.58%)
Mutual labels:  bsc, binance
binance-php
Binance API Like the official document interface, Support for arbitrary extension.
Stars: ✭ 83 (-3.49%)
Mutual labels:  binance, kucoin
CryptoCurrency
Page to keep track of value & profits of a portfolio of cryptocurrency (based on Coinmarketcap, Bitfinex and Binance)
Stars: ✭ 27 (-68.6%)
Mutual labels:  portfolio, binance
botdexdamar
🤖 multichain trading bot with sniper, frontrun, backrun, sandwich
Stars: ✭ 124 (+44.19%)
Mutual labels:  bsc, binance
Acria-Contracts
Contracts for the ETH/BSC branch of the Acria Network
Stars: ✭ 31 (-63.95%)
Mutual labels:  binance, binance-smart-chain
bsc-archive-snapshot
Free public Binance Smart Chain (BSC) Archive Snapshot
Stars: ✭ 71 (-17.44%)
Mutual labels:  bsc, binance-smart-chain
ethereum-kit-ios
Comprehensive EVM SDK (ex: Ethereum, Binance Smart Chain) for iOS, implemented on Swift. Create wallets, watch wallets (read-only), sync transactions, filter transactions by type (erc20, bep20, swap transactions etc.), swap using native DEX protocols, easily extendable to work with custom smart contracts, and full support for EIP1159.
Stars: ✭ 148 (+72.09%)
Mutual labels:  bsc, binance-smart-chain
cryptowallet-cli
CW is a crypto wallet generator CLI tool for a lot of blockchains: Bitcoin, Ethereum, Binance Smart Chain and many others
Stars: ✭ 45 (-47.67%)
Mutual labels:  polygon, binance-smart-chain

farm.army - Backend

Track your farming and pool performance on the Binance Smart Chain, Polygon, Fantom, KuCoin Community Chain, Harmony, Celo, Moonriver, Crypto.com: Cronos, Moonbeam

Platforms

Platforms must be self-managed and extract directly from chain contracts. As fallback javascript ast node parsing is allowed to get addresses from pages directly

Tech Stack

  • node.js
  • sqlite

Business Values

  • blockchain data MUST be called aggregated eg with "multicall" or "rpc wrapper" there should not be any direct single contract reading calls
  • blockchain endpoints are slow, so runs should be in parallel with splitting http call to different URLs

Technical Debt

  • Price discovery of a single token; multiple implementations
  • Reduce platform duplicate codes
  • Normalize platform "configuration format" of farms
  • Reduce manually task to generate farm.json for some platforms; basically set the breakpoint in foreign platform javascript files (chrome) and dump the JSON configs (mostly all have the same pattern)
  • ...

Call Stack

Platforms

Platforms need to provide following implementations

  • getFarms All farm, vaults, pools should be cached for all calls; should no be cached for background calls this are the data "refreshers"
  • getAddressFarms(address) Get possible farms for an address, should be cached longer and should call needed contract values (also its normally the same as the following endpoint)
  • getYields(address) Get all address farms with balances, rewards, ... cache can be lower, request should to take too long, else user need to wait long for the overview page
  • getDetails(address, farm) Detail information for an address farm; request can to more stuff

Install

npm install
sqlite3 var/db.db < db.sql

Optional: create a config file with custom configuration

config.json => config.json.local

Config

Additional config parameters

# config.json.local

# add custom / private rpc urls
"MOONRIVER_RPC": "https://foo.rpc,https://foo1.rpc",
"POLYGON_RPC": "https://foo.rpc,https://foo1.rpc",

# additional proxy for web3 rpc calls (for load balancing)
"WEB3_PROXIES": "https://YOUR.proxy:3128,https://YOUR_2.proxy:3128"

# proxy for some http related traffic only (load balancing)
"DEFAULT_PROXY": "https://YOUR_2.proxy:3128",

Start

node src/index.js

Endpoints

Cross-Chain

  /farms
  /yield/:address

Per Chain

  /:chain/farms
  /polygon/farms
  /fantom/farms
  /kcc/farms
  /harmony/farms
  /celo/farms
  /moonyriver/farms
  /cronos/farms
  /cronos/moonbeam
  /:chain/wallet/:address
  /:chain/nft/:address

:chain: bsc, polygon, fantom, kcc, harmony, celo, moonriver, cronos, moonbeam

  /:chain/all/yield/:address

Generate Farm

node src/command/farm_fetcher.js <masterChefAddress> <chain: bsc (default), polygon>
node src/command/farm_fetcher.js 0x76FCeffFcf5325c6156cA89639b17464ea833ECd
node src/command/farm_fetcher.js 0xC8Bd86E5a132Ac0bf10134e270De06A8Ba317BFe polygon
node src/command/farm_fetcher.js 0x9083EA3756BDE6Ee6f27a6e996806FBD37F6F093 fantom

Farm / Pool Contract

Every farm contract should be converted / provided in a common format. Still feature early definition

  {
    "id": "pancake_farm_foobar", // required and should be somehow unique and should not change (so no index) 
    "name": "Syrup-BNB", // required
    "token": "syrup-bnb", // optional (fallback on "name" if not given, eg for icon)
    "platform": "pancake", // required
    "earns": ["bake"], // optional (deprecated)
    "earn": [
      {
         "address": "0x1234ABC...",
         "symbol": "foo",
         "decimals": 18
      }
    ], // optional
    "link": "https:\/\/pancakeswap.finance\/farms", // required
    "has_details": true, // optional provide a detail link in frontend
    "notes": ['note_1', 'note_1'] // optional note of the farm; will be join in frontend
    "compound": true|false // optional if auto-compounding
    "leverage": true|false // optional if vault is leveraged
    "chain": "bsc|polygon|kcc|fantom|harmony" the chain for this vault
    "flags": ["lend", "borrow", "deprecated"], some custom tags for frontend badges
    "extra": {
      "lpAddress": "0x0e09fabb73bd3ade0a17ecc321fd13a19e81ce82", // to given hint about liquity split calculation
      "transactionToken": "0x0e09fabb73bd3ade0a17ecc321fd13a19e81ce82", // "in" and "out" transaction token
      "transactionAddress": "0x73feaa1eE314F8c655E354234017bE2193C9E24E" // "from" and "to" transaction
      "pricePerFullShare": 1.0408062780129632, // auto vault yield pools normally just wrap the "lpAddress" with a token which price is increasing; so just the multiplier
      "pricePerFullShareToken": "0xA9936272065e6DDAc9D2453C9a2712B581e9aE1B" // if given the value of "pricePerFullShare" is writting into database for historical data 
    },
    "tvl": {
      "amount": 212497359.08927876, // optional and not used
      "usd": 2832998380.971941 // optional
    },
    "yield": { // yearly values in percent eg 12.12%. apy or apr can be given (TODO: normalize to one)
      "apy": 553.9292024968477,
      "apr": 12.9292024968477,
    },
    actions: [ // web3 actions to directly call via Metamask (web3 providers)
      {
        "method": "deposit" // contract method
        "inputs": [70,0] // method parameters
        "type": "claim_fake" // custom type if known: "claim", "claim_all", "claim_fake", "emergency_withdraw"
        "contract": "0xDbc1A13490deeF9c3C12b44FE77b503c1B061739" // contract address      
      }
    ]
  },
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].