Function storage_get_evicted

Source
pub fn storage_get_evicted() -> Option<Vec<u8>>
Expand description

Reads the most recent value that was evicted with storage_write or storage_remove command.

§Use cases

Storage functions are typically used to upgrade/migrate a contract state, preventing errors like Cannot deserialize the contract state after rolling out the breaking changes to the network. For practical examples, see different implementations in this repository.

§Examples

use near_sdk::env::{storage_write, storage_remove, storage_get_evicted};

assert_eq!(storage_get_evicted(), None);