Inspiration

Writing true unit tests requires code to be tested in isolation from its dependencies. One way of achieving this is to use a mocking tool, that provides programmable replacements for this dependencies.

What it does

Doppelganger provides a simple Javascript class that allows the programmer to deploy a generic and very flexible smart contract that can pretend to be any other smar contract. All the implementation details are hidden from the programmer behind an easy and clean javascript interface.

How I built it

Doppelganger started out as a remix IDE project. By using the building debugger I was able to iterate quickly on the Proof-of-Concept, and get the necessary assembler right.

Challenges I ran into

I had to go down to the assembler/bytecode level of the EVM to achieve the desired effect. Documentation for this part of Ethereum is very sparse and fragmented.

Accomplishments that I'm proud of

I managed to hack together a working tool that has potential to change the way we test our smart contracts.

What I learned

Bytecode. Lot's of bytecode.

What's next for Doppelganger

More programmable behaviours (e.g. revert). Call tracing.

Built With

Share this project:

Updates