Skip to content

Stylus SDK 0.2.2

Compare
Choose a tag to compare
@rachel-bousfield rachel-bousfield released this 07 Sep 00:38
· 158 commits to stylus since this release
af88573

This backwards-compatible patch release makes documentation improvements, along with one minor feature addition.

StorageKey

You can now implement custom keys for mappings.

impl StorageKey for Key {
    fn to_slot(&self, root: B256) -> U256 {
        // return a slot
    }
}

The above then enables

sol_storage! {
    mapping(Key => Value) map;    // in solidity
}

#[solidity_storage]
pub struct Contract {
    map: StorageMap<Key, Value>,  // or in Rust
}