Skip to content

Commit

Permalink
apply suggestions from code review
Browse files Browse the repository at this point in the history
  • Loading branch information
uint committed Dec 16, 2024
1 parent 9a49240 commit 40b103d
Showing 1 changed file with 17 additions and 4 deletions.
21 changes: 17 additions & 4 deletions src/pages/storey/migration-plus.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ tags: ["storey", "storage-plus"]

import { Callout, Tabs } from "nextra/components";

# Migrating from cw-storage-plus to storey

This section is a "cheat sheet" to migrating from `cw-storage-plus` to `storey`. It's ideal for
those who have already used `cw-storage-plus`. Feel free to use it to migrate your contracts.

Expand All @@ -24,14 +26,25 @@ Here's a simple example:
```rust template="storage"
use cw_storage_plus::Map;

type Address = String; type Token = String;
type Address = String;
type Token = String;

let balances: Map<(Address, Token), u128> = Map::new("b");

balances .save(&mut storage, ("alice".to_string(), "uusd".to_string()), &100) .unwrap();

assert_eq!( balances .load(&storage, ("alice".to_string(), "uusd".to_string())) .unwrap(), 100 );
balances
.save(
&mut storage,
("alice".to_string(), "uusd".to_string()),
&100,
)
.unwrap();

assert_eq!(
balances
.load(&storage, ("alice".to_string(), "uusd".to_string()))
.unwrap(),
100
);
````

</Tabs.Tab>
Expand Down

0 comments on commit 40b103d

Please sign in to comment.