Skip to content
This repository was archived by the owner on Nov 11, 2022. It is now read-only.

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
GalloDaSballo authored Jul 14, 2022
1 parent 5551134 commit 12bf694
Showing 1 changed file with 56 additions and 0 deletions.
56 changes: 56 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,23 @@

## Release V0.2 - Pricer - BribesProcessor - CowswapSeller

# CoswapSeller

OnChain Integration with Cowswap, all the functions you want to:
- Verify an Order
- Retrieve the OrderUid from the orderData
- Validate an order through basic security checks (price is correct, sends to correct recipient)
- Integrated with an onChain Pricer (see below), to offer stronger execution guarantees

# BribesProcessor

Anti-rug technlogy, allows a Multi-sig to rapidly process cowswap orders, without allowing the Multi to rug
Allows tokens to be rescued without the need for governance via the `ragequit` function

# MainnetPricing

Given a tokenIn, tokenOut and AmountIn, returns a Quote from the most popular dexes

## Dexes Support
- Curve
- UniV2
Expand All @@ -11,3 +28,42 @@

Covering >80% TVL on Mainnet.

## Example Usage

NOTE: Because of Balancer and UniV3 (go bug their devs pls), the following functions are not view, you must `.call` them from offchain to avoid spending gas

### isPairSupported

Returns true if the pricer will return a non-zero quote
NOTE: This is not proof of optimality

```solidity
/// @dev Given tokenIn, out and amountIn, returns true if a quote will be non-zero
/// @notice Doesn't guarantee optimality, just non-zero
function isPairSupported(address tokenIn, address tokenOut, uint256 amountIn) external returns (bool)
```

In Brownie
```python
quote = pricer.isPairSupported.call(t_in, t_out, amt_in) ## Add .call to avoid paying for the tx
```

### findOptimalSwap

Returns the best quote given the various Dexes, used Heuristics to save gas (V0.3 will focus on this)
NOTE: While the function says optimal, this is not optimal, just best of the bunch, optimality may never be achieved fully on-chain

```solidity
function findOptimalSwap(address tokenIn, address tokenOut, uint256 amountIn) external virtual returns (Quote memory)
```

In Brownie
```python
quote = pricer.findOptimalSwap.call(t_in, t_out, amt_in) ## Add .call to avoid paying for the tx
```


# Mainnet Pricing Lenient

Variation of Pricer with a slippage tollerance

0 comments on commit 12bf694

Please sign in to comment.