Skip to content

Solidity/Ethereum knowledge test: trade/swap implementation assessment

License

Notifications You must be signed in to change notification settings

sambacha/swap-compare

Repository files navigation

SwapMeHarder

Important

This is an example showing the usage difference between case/switch vs. If/else

Compare the implementation of the two different functions in contracts/SwapMeHarder.sol. They are suppose to implement a swap functionality for trading. They achieve the same* results, but from slightly different ways.

Warning

same is, well, you will see.


Objectives

calculate: transaction cost
calculate: execution cost
determine best implementation for general use case
determine best implementation for bespoke/specific use case

Brownie points:

Any defects or anti-patterns?
Any additional optimizations? (Yul versions do not count!)

Key Results

Decided which one to use, and any additional caveats
What further enhancements could be made?

Summary

Which implementation is gas minimizing?
Which implementation is better? Does the answer depend on pairs/markets/etc?


License

MIT

Notice

About

Solidity/Ethereum knowledge test: trade/swap implementation assessment

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published