Skip to content

Commit

Permalink
doc: Update Mapping Declaration Section
Browse files Browse the repository at this point in the history
Upadate ink! mapping syntax to comform
with ink v4

Description
===========
- Removed unnecessary imports.
- Updated the ink! mapping syntax.
- Removed outdated reference to
  `ink_lang::utils::initialize_contract`.
  • Loading branch information
0xf333 committed Aug 27, 2023
1 parent cd352e3 commit c1e0a44
Showing 1 changed file with 1 addition and 7 deletions.
8 changes: 1 addition & 7 deletions docs/intro/ink-vs-solidity.md
Original file line number Diff line number Diff line change
Expand Up @@ -262,20 +262,14 @@ mapping(address => uint128) private mapName;

```rust
//ink!
use ink_storage::{
traits::SpreadAllocate,
Mapping,
};
use ink::storage::Mapping;

#[ink(storage)]
#[derive(SpreadAllocate)]
pub struct ContractName {
map_name: Mapping<AccountId, u128>,
}
```

When using a map in ink!, `ink_lang::utils::initialize_contract` must be used in the constructor. See [here](https://use.ink/datastructures/mapping) for more details.

### `mapping usage`

```c++
Expand Down

0 comments on commit c1e0a44

Please sign in to comment.