Skip to content

Commit

Permalink
chore: Readme with basic docs
Browse files Browse the repository at this point in the history
  • Loading branch information
GalloDaSballo committed Oct 20, 2022
1 parent 00850ab commit b87732c
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 3 deletions.
30 changes: 29 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Fair Selling
# OnChainPricerV4 + SwapExecutor

## WARNING

Expand Down Expand Up @@ -126,6 +126,34 @@ quote = pricer.unsafeFindExecutableSwap(t_in, t_out, amt_in)
Variation of Pricer with a slippage tollerance, mostly used to allow a multisig enough wiggle room for operation


## SwapExecutor

Executes Quotes based on the PricerV4, leveraging all possible pools (and more technically)

SwapExecutor enables projects to deploy one contract, which is robust enough to offer most features for most mainnet AMMs (over 80% of TVL is in top 5 AMMs on ETH).

At the same time it's flexibile enough to enable handling pools currently not covered by the pricer.

This is the first step towards maintainable swaps, that don't require upgrades.

Supports all protocols and pools from PricerV4

It's meant to be used as a router contract, it will use the tokens you sent and send the tokens back to the caller

### doOptimalSwap

```solidity
function doOptimalSwap(address tokenIn, address tokenOut, uint256 amountIn) external returns(uint256){
```
Retrieves a Chainlink Price Feed Protected Quote from PricerV4 and executes it

### doOptimalSwapWithQuote
```solidity
function doOptimalSwapWithQuote(address tokenIn, address tokenOut, uint256 amountIn, Quote memory optimalQuote) public returns(uint256){
```

Uses any Quote (even unprotected ones) and executes it


# Notable Tests

Expand Down
4 changes: 2 additions & 2 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
OnChainPricingMainnet,
OnChainPricingMainnetLenient,
FullOnChainPricingMainnet,
OnChainSwapMainnet
SwapExecutor
)
import eth_abi
from rich.console import Console
Expand Down Expand Up @@ -50,7 +50,7 @@

@pytest.fixture
def swapexecutor(pricer):
return OnChainSwapMainnet.deploy(pricer.address, {"from": accounts[0]})
return SwapExecutor.deploy(pricer.address, {"from": accounts[0]})

@pytest.fixture
def mainnetpricer():
Expand Down

0 comments on commit b87732c

Please sign in to comment.