
Captain Happy Hook
A Uniswap v4 hook to make fairly distributed swaps: no frontrunning, minimise prize impact
About
The problem it solves Attacks e.g. Frontrunning, sandwich... Price Impact e.g. for small trades after large ones Reverted tx e.g. for price spikes
How it's made
Challenges we ran into - The contract's data structure: we iterated through 3 different approaches. In the end we found an intermediate solution between nested struct and just int[] & address[]... Finally we used a struct, but a simpler one. - Foundry testing: we struggled initialising our contract from the test and processing data from our contract's functions and state variables, making it slower to write assertions. Once we got our setup working, we could work on multiple tests. - Chainlink Automation: figuring out how to set up checkUpkeep and getting the tests to pass took us especially long. We had to debug small errors such as uint & int conversions,