Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/bloq/sol-qualify-lp

Solidity/Ethereum dapp to qualify LP tokens as Uniswap or Balancer LPs
https://github.com/bloq/sol-qualify-lp

balancer dapp defi ethereum ethereum-contracts solidity solidity-contracts uniswap

Last synced: 10 days ago
JSON representation

Solidity/Ethereum dapp to qualify LP tokens as Uniswap or Balancer LPs

Awesome Lists containing this project

README

        

# qualify-lp

## Summary

Perform simple ABI checks, to determine if an address seems to behave
like a Uniswap or Balancer LP pool token.

## Using

### Step 1 - qualify LP token

Call `qualifyUniswapLP()` or `qualifyBalancerLP()` to validate an LP token, and add it to the database.

### Step 2 - query qualifications database

Import the interface file `IQualifyLP.sol` into a solidity contract, then treat as a simple mapping:

```
function do_something_with_lp_token(address lpToken) internal returns (bool) {
address LPQualAddr = address(0xeE87996440515154fb913Fada7aBB4F2Caecb14f);
IQualifyLP lpQual = IQualifyLP(LPQualAddr);
uint256 constant LP_UNISWAP = 1;

// check QualifyLP's mapping of validated tokens
uint256 qualResult = lpQual.qualified(lpToken);

// require that lpToken is a Uniswap-like pair liquidity pool contract
// Requires someone MUST have previously called qualifyUniswapLP() at some
// point in the past.
require(qualResult == LP_UNISWAP);
}
```

## Deployment

Ethereum mainnet deployment, v0.9.0: [0xeE87996440515154fb913Fada7aBB4F2Caecb14f](https://etherscan.io/address/0xee87996440515154fb913fada7abb4f2caecb14f)

## Caveats

This can only provide a minimum guarantee that the address provided _seems to behave like_ a Uniswap
or Balancer pool token. A fork such as SushiSwap, using the same
ABI as Uniswap, will pass these qualifications (there is a plan to fix this limitation in the next version,
by using the Uniswap Router).