Upgrade Cadence to 0.0.40.

Closes #43.
Complete Cadence upgrade.

See #43.