I don't have time to make a proper PR for this right now, but thought that someone might found what I've written so far useful.
I pretty much just took the javascript code and directly translated it. Then made it work with brownie's contracts. It could definitely be cleaned up more since it isnt in JS and some of those patterns are a bit awkward in python. but its working for me on hardhat-fork.
https://gist.github.com/WyseNynja/b95840d089a8a38a613b9271858d0a66
I don't have time to make a proper PR for this right now, but thought that someone might found what I've written so far useful.
I pretty much just took the javascript code and directly translated it. Then made it work with brownie's contracts. It could definitely be cleaned up more since it isnt in JS and some of those patterns are a bit awkward in python. but its working for me on hardhat-fork.
https://gist.github.com/WyseNynja/b95840d089a8a38a613b9271858d0a66