Compositional Security for Smart Contracts