Skip to content

0xSplits/splits-swapper

Repository files navigation

splits-swapper

Docs

What

Swapper is a payments module that trustlessly & automatically transforms multi-token revenue into a single output token

Why

Many onchain entities (e.g. creators, collectives, DAOs, businesses) generate onchain revenues in tokens that don't match the denominations of their expenses (e.g. salaries, taxes) resulting in asset-liability currency mismatch. More generally, many onchain value flows benefit technically and financially from the ability to curate the denomination.

How

Sequence diagram of successful example call to Swapper#flash

How does it swap?

Directly with traders via integration contracts required to handle #flash's callback #swapperFlashCallback.

How does it price swaps?

Modularly, via each Swapper's designated IOracle. Each Swapper may also apply it's own default & quote-specific scaling factors to said oracle's pricing.

How is it governed?

A Swapper's owner, if set, has FULL CONTROL of the deployment. It may, at any time for any reason, change the beneficiary, tokenToBeneficiary, oracle, defaultOfferScaledFactor, pairScaledOfferFactors, as well as execute arbitrary calls on behalf of the Swapper. In situations where flows ultimately belong to or benefit more than a single person & immutability is a nonstarter, we strongly recommend using a multisig or DAO for governance. To the extent your Oracle has an owner as well, this same logic applies.

Lint

forge fmt

Setup & test

forge i - install dependencies

forge b - compile the contracts

forge t - compile & test the contracts

forge t -vvv - produces a trace of any failing tests

Natspec

forge doc --serve --port 4000 - serves natspec docs at http://localhost:4000/

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •