On the brink of a second financial system: modelling and mitigating risk in decentralised finance