File tree Expand file tree Collapse file tree 1 file changed +18
-1
lines changed
integration-tests/public/bytes Expand file tree Collapse file tree 1 file changed +18
-1
lines changed Original file line number Diff line number Diff line change 11#![ cfg_attr( not( feature = "std" ) , no_std, no_main) ]
22
3+ /// Example for using bytes wrapper types (i.e. `ink::sol::FixedBytes<N>` and
4+ /// `ink::sol::DynBytes`) as message and event arguments.
5+ ///
6+ /// # Note
7+ ///
8+ /// In Solidity ABI encoding, `uint8[]` and `uint8[N]` are encoded differently from
9+ /// `bytes` and `bytesN`. In Rust/ink!, `Vec<u8>` and `[u8; N]` are mapped to Solidity's
10+ /// `uint8[]` and `uint8[N]` representations, so there's a need for dedicated Rust/ink!
11+ /// types (i.e. `ink::sol::DynBytes` and `ink::sol::FixedBytes<N>`) that map to Solidity's
12+ /// `bytes` and `bytesN` representations.
13+ ///
14+ /// # References
15+ ///
16+ /// - <https://use-ink.github.io/ink/ink_primitives/sol/struct.FixedBytes.html>
17+ /// - <https://use-ink.github.io/ink/ink_primitives/sol/struct.DynBytes.html>
18+ /// - <https://use.ink/docs/v6/background/solidity-metamask-compatibility#rustink-to-solidity-abi-type-mapping>
19+
320#[ ink:: event]
421pub struct FixedBytesPayload {
522 pub data : ink:: sol:: FixedBytes < 8 > ,
@@ -21,7 +38,7 @@ pub mod bytes {
2138 pub struct Bytes ;
2239
2340 impl Bytes {
24- /// Creates a new bytes smart contract.
41+ /// Creates a new smart contract.
2542 #[ ink( constructor) ]
2643 #[ allow( clippy:: new_without_default) ]
2744 pub fn new ( ) -> Self {
You can’t perform that action at this time.
0 commit comments