Take control of anyone’s Smart Contracts
We can predict disasters on blockchain. We can even make them happen.
More and more economic value is circulating on the Ethereum blockchain, especially after the explosion of DeFi activity in 2020. Organisations in the ecosystem are heavily interlinked, with many services backed by tokens that are themselves backed by tokens. For example, users can generate DAI on MakerDAO by posting dozens of other tokens as collateral. The DAI generated can then be used as collateral in other protocols. Should DAI fail, downstream protocols will feel the effects. The token risk extends beyond those who are merely hodling.
The good news is that all these interconnections are programmatic. We can quite accurately predict what could happen following any given event because we know what functions would execute. The other good news is that the Ethereum blockchain is easy to copy. We can generate a complete copy of Mainnet with all its existing contracts in place. These two features of Ethereum mean that we can quickly run simulations to see what would happen if we crashed token X or Y.
If such a crash occurs, what other Ethereum protocols would be affected? What would happen to them? Even if we copied Mainnet, we wouldn’t be able by default to change third-party smart contracts. To do that, we would need some kind of tool to let us override smart contract security restrictions. Then we could run protected smart contract functions and create or destroy other people’s tokens.
This is where GodMode comes in.
What is it?
GodMode is an open-source toolset that lets you control third-party smart contracts on Ethereum. Play around with test versions of real contracts (Compound, Maker, Uniswap) and see what happens when things change. Mint, move and destroy any tokens. Take control of any wallet. With these capabilities, you can forecast risk and get a better insight into your what-if scenarios. You can incorporate GodMode into your existing projects as a javascript library and use it to enhance your testing. It also runs as a standalone modelling tool.
What does it do?
GodMode creates modified copies of the Ethereum blockchain which let you bypass contracts’ require statements and other controls. You can then call contract methods and make changes that aren’t otherwise available to you on Mainnet. Once you’ve made your changes, the effects will be visible on other protocols linked to the smart contract(s) you’ve amended. You’ll then have a better idea about what would happen if your GodMode testing scenario came true. As you’re only working on a test copy of Mainnet, you can do this without any risk to your real assets.
Who is it for?
Smart Contract Developers can use GodMode to identify risks to services they build. From there, they can create extra protections against financial or technical contagion. For example, a lending service could restrict the automatic triggering of liquidations following the hacking and draining of an upstream contract.
Traders and Funds could integrate GodMode scenario testing into their investment strategies. They could minimise risk exposure and identify openings for a more significant investment return that may not be commonly known. For instance, a change in the peg of a stablecoin could trigger hidden arbitrage opportunities. Testing against this scenario could be programmed into trading algorithms and execute automatically should the situation arise.
How do I use it?
GodMode is a set of node.js libraries that you can include in your projects.
You can find the full suite on our Github. An excellent place to start is the Sample Project which lets you quickly see GodMode in action. In the Sample Project, you can spin up a local Ganache instance using our modified godmode-ganache-cli library. Running the Sample Project tests demonstrates the before and after taking control of contracts in a GodMode environment.
We’re constantly adding new features, protocols and learning resources to the GodMode ecosystem. For a fuller rundown of how it works, or to make development requests of your own, come and join the conversation on our Discord. We’re always interested in feedback that will allow us to make GodMode an ever-better development experience.