Ethereum Holds Its Breath as $150M Left Exposed to Single Developer

yearn.finance, an Ethereum application that capitalizes on a mix of different yield farming opportunities to create a single entry point for 1,000%+ returns, has just led to the greatest blockchain scare of 2020.
So far, decentralized finance (DeFi) has escaped with relatively few exploits. One of the largest came from bZx, a protocol that saw $360K stolen in an attack earlier this year. But the bZx attack would have been dwarfed by what could have unfolded in the last 72 hours. If it weren’t for the grace of DeFi builder, Andre Cronje, things could have gone south for everyone.
On July 17th Andre’s recently launched yearn.finance application announced a new token – YFI.
This token, which featured no venture capital funding, developer fund or “pre-mine” was launched with little fanfare.
Earning YFI is simple, provide liquidity to one of the platforms above, stake the output tokens in the distribution contracts (we will provide an interface for this), and you will earn a (governance controlled) amount per day.
Andre Cronje
The governance token, YFI, was earned through a series of relatively complex steps, beginning with the decentralized stablecoin exchange, Curve and moving through Balancer and the new yearn.finance platform to maximize yields.
According to Andre’s post, the YFI token had “0 financial value”.
Being a transferable ERC-20 token, however, it was up to the market to decide what value YFI had. In just over 24 hours the token soared from zero to over $1,750 with a market capitalization that exceeded $10 million.
But that’s not even half the story.
The steps necessary to earn YFI (Curve and Balancer) attracted hundreds of millions of dollars to their smart contracts.

Total Value Locked (TVL) in Curve Finance shot up vertically as users scrambled to earn the very real 1,000%+ yields that were being distributed. This resulted in Curve clocking record breaking volumes that surpassed the likes of Kraken.
At the time, well over $100 million of liquidity was held in the Balancer and Curve smart contracts that underpinned YFI.
Now, for those that haven’t followed Andre, he is known for his gung ho approach to DeFi development. The code that Andre writes is never audited (something he is transparent about) and he is famous for his Twitter bio, “I test in prod” (prod meaning production).
Despite this knowledge and with a textbook bystander effect, no one thought to do even the most basic of due diligence. “Surely given Andre’s history of not testing or auditing his code, someone else has checked something… right?”
Well they hadn’t. At least not publicly. It was left to a user by the name of “trent e” to call out the YFI ERC-20 contract code – a Tweet that should have sent shivers down the spine of any and all Ethereum users.
It transpired that the code underlying YFI gave Andre Cronje complete freedom to arbitrarily mint new tokens. To many this wasn’t surprising, Andre needed to seed the YFI rewards and of course he needed this control (for those interested, I’ve explained the code at the bottom of this article).
But perhaps they didn’t quite follow the full extent of what had just happened.
By yesterday evening, self-funded DeFi builder, Andre, unwittingly found himself with the keys to over one hundred million dollars. It would have been possible, with the right inclination, for Andre to print infinite YFI and exchange this YFI for all the DAI and yCurve held in Balancer. For a developer like Andre, this would have been trivial. And there was nothing anyone could do about it.
Andre did not take this path. It’s unlikely it ever even crossed his mind. And in the hours after it became clear that the community had jitters about his ownership, Andre swiftly implemented a multi-signature wallet and handed it to the community. Andre chose not to be a signatory.
Disaster averted. So why should we care? Well, ignoring Andre’s own moral code for a second, his ownership of the keys to those funds would make him a target for criminals. Ransoms and “five dollar wrench” attacks are a real threat to public figures with large holdings.
But that’s not the only reason. For a brief moment in Ethereum, the vast majority of users interacting with YFI unknowingly handed over unimaginable power to a single person. We have to do better.
If those keys were with another developer, who knows whether the theft would have taken place. The fallout from an action like that cannot be overstated. Decentralized Finance would have suffered a $100 million exploit – the largest exploit ever seen in Ethereum and one of the largest thefts in history. The ecosystem would have been set back years.
The Code
When the contract is deployed, the constructor()
function is called and a variable named governance
is set to the Ethereum address of the user who created the contract (in this case, Andre):
constructor () public ERC20Detailed("yearn.finance", "YFI", 18) {
governance = msg.sender;
}
The following function gives permission to the address stored in governance
to add any address to the minter role:
function addMinter(address _minter) public {
require(msg.sender == governance, "!governance");
minters[_minter] = true;
}
And this function allows any of the addresses stored in minters
to mint new YFI tokens without limit:
function mint(address account, uint amount) public {
require(minters[msg.sender], "!minter");
_mint(account, amount);
}
This code is about as basic as it gets in Solidity. Yet not a single word was mentioned until the pot grew into the hundreds of millions.
For a moment, a confidence-breaking chunk of DeFi was passed into the hands of a single developer. Whether you used YFI or not, we should all be grateful for the integrity of Andre Cronje and more importantly, we must take this lesson forward.