- Blockchain
- Cryptocurrency
- Fintech
The challenge
Synthetix wanted to create a cryptocurrency-based platform where
multiple stable coins - each pegged to a global currency - could be
traded with each other quickly without having to use an exchange to
convert between currencies.
A key challenge in this space is that the underlying technology is set
up to prevent code changes (smart contracts are unchangeable once
deployed). Any code that is deployed is completely out in the open and
can be attacked at any time, and there’s no kill switch you can pull
to stop it unless you build one in, which is itself potentially
exploitable. In addition, all the tooling is still maturing (and often
requires in-depth knowledge to produce value with it). A single wrong
step in migration can be catastrophic.
The solution
Working closely with Synthetix, as well as blockchain experts
Coinage, the Exogee team evolved the
decentralised Ethereum based single currency stablecoin platform into
a synthetic asset platform with support for a large number of tracked
assets.
Before doing any work, we ensured that we understood the existing
mathematical model. We then worked to create a new model that would
support multiple currencies, and crucially allow people who hold a
particular asset to swap it for another without having to hold the
underlying value token (SNX). The technical challenges in this are
vast, as many traditional programming paradigms (such as large loops)
just don’t work in Solidity due to the way computation is paid for on
the network.
Once we settled on a model that worked in theory, we first modelled it
in Excel to see if it stood up to scrutiny. It took approximately 4
different models until we were confident that what we had would work
in all cases including extreme edge cases from users attempting to
exploit the model.
At this point the team expressed a concern about an existing technical
component of their architecture called an oracle. The legacy oracle
was constantly losing its ability to send price updates to the
blockchain, and the existing monitoring tools also sometimes failed to
detect this scenario. The existing workaround to reboot the oracle
server every 15 minutes was far from ideal. Their team had been
working on the existing oracle for approximately 6 months at this
stage. We built a more robust version using AWS standard tooling
(Lambda and CloudWatch) in 2 weeks. It has functional monitoring that
plots metrics over time and can also notify the team via Slack, email,
and SMS, escalating to various support tiers as problems remain
unresolved.
The value
The solution we built consisted of 32 interconnected smart contracts,
making Synthetix one of the most complicated smart contract networks
in the defi space as a whole. A security audit on the entire network
of contracts found no vulnerabilities at all. We deployed the
contracts and successfully handed the work over to the internal team
to maintain and improve. Since then, Synthetix has gone from strength
to strength.
At the time of writing, there’s currently in excess of $600 million of
value protected by the Ethereum smart contracts we created.