How to save strings in the storage of dapp?

I resolved this like that

...

pub struct Config {
    name: str[32],
    symbol: str[8],
    decimals: u8,
}


storage {
    config: Config = Config {
        name: "                                ",
        symbol: "        ",
        decimals: 1u8,
    },
    owner: Address = Address {
        value: ZERO_B256,
    },
    mint_amount: u64 = 0,
    mint_list: StorageMap<Address, bool> = StorageMap {},
}

...

#[storage(read)]
    fn config() -> Config {
        storage.config
    }

...
1 Like