Git Product home page Git Product logo

impermax-filter's Introduction

impermax-filter

This repo provide a simple filter function for those using the Impermax dapp.

Motivation

As of today, Impermax still needs to implement a filter feature for their markets. There is no easy way to select only a single token or token list, nor order the markets by supply, borrow or farm APR.

How-to Guide

There is no installation for this. You need to use your browser's Dev Tools console (F12).

  • Open Impermax dapp.
  • Once on markets page, after all markets are loaded, open Dev Tools console (F12).
  • Paste impermaxFilter function from filter.js or filter.min.js into the console.
  • Call the function using the tokenList and order (and optionally rearrangeDOM) arguments.
  • Done.

Arguments

impermaxFilter(tokenList, order, rearrangeDOM);

tokenList: Array containing strings for each token you want to filter in the search.

order: String for desired ordering mode. Allowed values: supply, borrow, farm. When informing supply or farm the order will be descending (as in higher is better) and if borrow the order will be ascending (as lower is better).

rearrangeDOM: If set to true, The function will filter and rearrange the DOM elements in the page itself. Default to false.

Sample call

impermaxFilter(['USDC', 'USDT', 'MAI', 'DAI'], 'supply');

Response

The response will be an Array containing the ordered and filtered list of market pairs.

[
    {
        "token": The token for this entry,
        "pair": The pair of token from the liquidity pool,
        "source": Where the liquidity pool is hosted,
        "supply": Supply APR,
        "borrow": Borrow APR,
        "farm": Farm APR,
        "href": URL at Impermax for the market,
        "row": Row element in the DOM
    },
    ...
]

If you set rearrangeDOM to true, the page itself will be changed. Check sample below, filtered by stablecoins only (USDC, USDT, DAI, MAI) and ordered by Supply APR.

Rearrange sample

Sample response

[
    {
        "token": "MAI",
        "pair": "DAI/MAI",
        "source": "QuickSwap",
        "supply": 0.5291,
        "borrow": 0.7104,
        "farm": 0.8690000000000001,
        "href": "https://polygon.impermax.finance/lending-pool/0x6d59c06a7f96a508310a76da84db397819e29c62",
        "row": [DOM Element Object]
    },
    {
        "token": "MAI",
        "pair": "MAI/USDT",
        "source": "QuickSwap",
        "supply": 0.5052,
        "borrow": 0.6797,
        "farm": 1.3846,
        "href": "https://polygon.impermax.finance/lending-pool/0xc3a4c0677b033bf6e9a4e22f930f1d60c5cd2c86",
        "row": [DOM Element Object]
    },
    {
        "token": "USDT",
        "pair": "USDC/USDT",
        "source": "SushiSwap",
        "supply": 0.4672,
        "borrow": 0.5722999999999999,
        "farm": 0.6775,
        "href": "https://polygon.impermax.finance/lending-pool/0x9b2f10eae09fad574b3f76b977c06634a4ec3a46"
        "row": [DOM Element Object]
    },
    ...
]

Tips are appreciated (Ethereum, BSC, Polygon, Fantom): 0xA6E126a5bA7aE209A92b16fcf464E502f27fb658

image

impermax-filter's People

Contributors

werlang avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar

Forkers

hayden97

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.