Store values in CBOR instead of JSON: The main reason is that it's a binary format because the DB stores byte arrays. It made less sense to use JSON than CBOR but there is little different considering the usecase.
flush the db when storing a swap (arguably the most import patch of the PR)
Few things on the DB: