@@ -23,29 +23,34 @@ slug: /background/solidity-metamask-compatibility
23
23
With ink! v6, we have introduced an ` abi ` field in a custom ` ink-lang ` table
24
24
in the [ ` package.metadata ` table] [ package-metadata ] of a contract's manifest
25
25
file (i.e. the ` Cargo.toml ` file) - [ more details here] [ abi-declaration ] .
26
- It allows building your contract in Solidity ABI compatibility mode.
26
+ It allows building your contract in Solidity ABI compatibility mode
27
+ when declared as follows:
27
28
28
29
``` toml
29
30
[package .metadata .ink-lang ]
30
31
abi = " sol"
31
32
```
32
33
33
- The implication of supporting Solidity ABI encoding is that all types used as constructor/message argument
34
- and return types, and event argument types must define a mapping to an equivalent Solidity ABI type.
34
+ The implication of supporting Solidity ABI encoding is that all types used as
35
+ constructor/message argument and return types, and event argument types must
36
+ define a mapping to an equivalent Solidity ABI type.
35
37
36
- This mapping is defined using the [ ` SolEncode ` ] [ sol-trait-encode ] and [ ` SolDecode ` ] [ sol-trait-decode ] traits,
37
- which are analogs to [ ` scale::Encode ` and ` scale::Decode ` ] [ scale-codec ] (but for Solidity ABI encoding/decoding).
38
+ [ package-metadata ] : https://doc.rust-lang.org/cargo/reference/manifest.html#the-metadata-table
39
+ [ abi-declaration ] : ../basics/abi/overview.md#declaring-the-abi
40
+
41
+ ## Rust/ink! to Solidity ABI type mapping
42
+
43
+ This mapping is defined using the [ ` SolEncode ` ] [ sol-trait-encode ] and
44
+ [ ` SolDecode ` ] [ sol-trait-decode ] traits, which are analogs to
45
+ [ ` scale::Encode ` and ` scale::Decode ` ] [ scale-codec ]
46
+ (but for Solidity ABI encoding/decoding).
38
47
You won't be able to use Rust types for which no mapping to a Solidity type exists.
39
48
An error about a missing trait implementation for this type will be thrown.
40
49
41
- [ package-metadata ] : https://doc.rust-lang.org/cargo/reference/manifest.html#the-metadata-table
42
- [ abi-declaration ] : ../basics/abi#declaring-the-abi
43
50
[ sol-trait-encode ] : https://docs.rs/ink/latest/ink/trait.SolEncode.html
44
51
[ sol-trait-decode ] : https://docs.rs/ink/latest/ink/trait.SolEncode.html
45
52
[ scale-codec ] : https://docs.rs/parity-scale-codec/latest/parity_scale_codec
46
53
47
- ## Rust/ink! to Solidity ABI type mapping
48
-
49
54
### Default/provided mappings
50
55
51
56
[ ` SolEncode ` ] [ sol-trait-encode ] and [ ` SolDecode ` ] [ sol-trait-decode ] are implemented
0 commit comments