@@ -117,11 +117,16 @@ use ink_primitives::Address;
117
117
///
118
118
/// # Usage outside the `#[ink::contract]` context
119
119
///
120
- /// The macro expects two arguments:
120
+ /// The macro expects up to three arguments:
121
121
/// - The first argument is the path to the trait, e.g. `Erc20` or `erc20::Erc20`.
122
122
/// - The second argument is the type of the [`ink_env::Environment`].
123
+ /// - The third argument is the marker type for the ABI (i.e. [`ink::abi::Ink`] or
124
+ /// [`ink::abi::Sol`]).
123
125
///
124
126
/// If the second argument is not specified, the macro uses the `Environment` type alias.
127
+ /// If the third argument is not specified, the macro uses the "default" ABI,
128
+ /// which depending on the ABI specified in the project's manifest
129
+ /// (see https://use.ink/docs/v6/basics/abi/ for details).
125
130
///
126
131
/// ```rust
127
132
/// use ink::contract_ref;
@@ -156,6 +161,7 @@ use ink_primitives::Address;
156
161
/// type AliasWithDefaultEnv = contract_ref!(Erc20, DefaultEnvironment);
157
162
/// type AliasWithCustomEnv = contract_ref!(Erc20, CustomEnv);
158
163
/// type AliasWithGenericEnv<E> = contract_ref!(Erc20, E);
164
+ /// type AliasWithCustomAbi = contract_ref!(Erc20, DefaultEnvironment, ink::abi::Ink);
159
165
///
160
166
/// fn default(mut contract: contract_ref!(Erc20, DefaultEnvironment)) {
161
167
/// let total_supply = contract.total_supply();
@@ -194,6 +200,15 @@ use ink_primitives::Address;
194
200
/// generic(contract)
195
201
/// }
196
202
///
203
+ /// fn custom_abi(mut contract: contract_ref!(Erc20, DefaultEnvironment, ink::abi::Ink)) {
204
+ /// let total_supply = contract.total_supply();
205
+ /// contract.transfer(total_supply, contract.as_ref().clone());
206
+ /// }
207
+ ///
208
+ /// fn custom_alias_abi(mut contract: AliasWithCustomAbi) {
209
+ /// custom_abi(contract)
210
+ /// }
211
+ ///
197
212
/// type Environment = DefaultEnvironment;
198
213
///
199
214
/// fn contract_ref_default_behaviour(mut contract: contract_ref!(Erc20)) {
0 commit comments