Swapper is a payments module that trustlessly & automatically transforms multi-token revenue into a single output token
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.
Directly with traders via integration contracts required to handle #flash
's callback #swapperFlashCallback
.
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.
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.
forge fmt
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
forge doc --serve --port 4000
- serves natspec docs at http://localhost:4000/