# Breaking changes in beta-3 ###### tags: `Internal` ## Sway Changes ### StorageMap `.get()` method returns `Option<>` type Previously StorageMaps would return a 0 value of the correct type if no value was set for a given key. Now, this method returns an Option type, which can be either `Some(value)` or `None`. Solution: Use the `unwrap_or()` method to unwrap the value or return a default value if `None` is found. ### Must use `#[payable]` for payable functions If you expect to receive assets in a function call, you must use the `payable` annotation. You can add it to a storage annotation like this: `#[storage(read, write), payable]`. ## Examples ### Web3rsvp contract 1. `.get()` returns `Option<>` type Hence, the following code fails: ```rust storage { events: StorageMap<u64, Event> = StorageMap {}, event_id_counter: u64 = 0, } let mut selectedEvent = storage.events.get(storage.event_id_counter - 1); return selectedEvent; ``` **Error:** ```bash return selectedEvent; ^^^^^^^^^^^^^^ Mismatched types. expected: Event found: Option<Event>. ``` ### Marketplace contract 1. `.get()` returns `Option<>` type (same as above) Hence, the following code fails: ```rust= require(item.id > 0, InvalidError::IncorrectItemID); ``` Error: ```bash require(item.id > 0, InvalidError::IncorrectItemID); ^^^^^^^ This is a Option<Item>, not a struct. Fields can only be accessed on structs. ``` Solution: Use `unwrap_or()` ```rust fn get_item(item_id: u64) -> Item { // returns the item for the given item_id let selected_item: Option<Item> = storage.item_map.get(item_id); selected_item.unwrap_or( Item { id: u64, price: u64, owner: Identity, metadata: str[20], total_bought: u64, } ) ```