@@ -83,14 +83,6 @@ pub trait IErc721Wrapper {
83
83
///
84
84
/// * [`Error::Erc721FailedOperation`] - If the underlying token is not an
85
85
/// ERC-721 contract, or the contract fails to execute the call.
86
- ///
87
- /// # Examples
88
- ///
89
- /// ```rust,ignore
90
- /// fn deposit_for(&mut self, account: Address, token_ids: Vec<U256>) -> Result<bool, Error> {
91
- /// self.erc721_wrapper.deposit_for(account, token_ids, &mut self.erc721)
92
- /// }
93
- /// ```
94
86
fn deposit_for (
95
87
& mut self ,
96
88
account : Address ,
@@ -114,14 +106,6 @@ pub trait IErc721Wrapper {
114
106
/// [`Erc721`] contract, or the contract fails to execute the call.
115
107
/// * [`Error::Erc721`] - If the wrapped token for `token_id` does not
116
108
/// exist.
117
- ///
118
- /// # Examples
119
- ///
120
- /// ```rust,ignore
121
- /// fn withdraw_to(&mut self, account: Address, token_ids: Vec<U256>) -> Result<bool, Error> {
122
- /// self.erc721_wrapper.withdraw_to(account, token_ids, &mut self.erc721)
123
- /// }
124
- /// ```
125
109
fn withdraw_to (
126
110
& mut self ,
127
111
account : Address ,
@@ -145,13 +129,6 @@ pub trait IErc721Wrapper {
145
129
///
146
130
/// * [`Error::UnsupportedToken`] - If `msg::sender()` is not the underlying
147
131
/// token.
148
- ///
149
- /// # Examples
150
- ///
151
- /// ```rust,ignore
152
- /// fn on_erc721_received(&mut self, operator: Address, from: Address, token_id: U256, data: Bytes) -> Result<FixedBytes<4>, Error> {
153
- /// self.erc721_wrapper.on_erc721_received(operator, from, token_id, data, &mut self.erc721)
154
- /// }
155
132
fn on_erc721_received (
156
133
& mut self ,
157
134
operator : Address ,
@@ -166,14 +143,6 @@ pub trait IErc721Wrapper {
166
143
/// # Arguments
167
144
///
168
145
/// * `&self` - Read access to the contract's state.
169
- ///
170
- /// # Examples
171
- ///
172
- /// ```rust,ignore
173
- /// fn underlying(&self) -> Address {
174
- /// self.erc721_wrapper.underlying()
175
- /// }
176
- /// ```
177
146
fn underlying ( & self ) -> Address ;
178
147
}
179
148
@@ -229,8 +198,10 @@ impl IErc721Wrapper for Erc721Wrapper {
229
198
let underlying = Erc721Interface :: new ( self . underlying ( ) ) ;
230
199
231
200
for token_id in token_ids {
232
- // Setting the `auth` argument enables the `_is_authorized` check which verifies that the token exists
233
- // (from != 0). Therefore, it is not needed to verify that the return value is not 0 here.
201
+ // Setting the `auth` argument enables the `_is_authorized` check
202
+ // which verifies that the token exists (from != 0).
203
+ // Therefore, it is not needed to verify that the return value is
204
+ // not 0 here.
234
205
erc721. _update ( Address :: ZERO , token_id, sender) ?;
235
206
underlying
236
207
. safe_transfer_from (
@@ -255,7 +226,7 @@ impl IErc721Wrapper for Erc721Wrapper {
255
226
_operator : Address ,
256
227
from : Address ,
257
228
token_id : U256 ,
258
- data : Bytes ,
229
+ _data : Bytes ,
259
230
erc721 : & mut Erc721 ,
260
231
) -> Result < FixedBytes < 4 > , Error > {
261
232
let sender = msg:: sender ( ) ;
@@ -265,7 +236,7 @@ impl IErc721Wrapper for Erc721Wrapper {
265
236
} ) ) ;
266
237
}
267
238
268
- erc721. _safe_mint ( from, token_id, & data ) ?;
239
+ erc721. _safe_mint ( from, token_id, & vec ! [ ] . into ( ) ) ?;
269
240
270
241
Ok ( RECEIVER_FN_SELECTOR . into ( ) )
271
242
}
@@ -284,6 +255,7 @@ impl Erc721Wrapper {
284
255
/// * `&mut self` - Write access to the contract's state.
285
256
/// * `account` - The account to mint tokens to.
286
257
/// * `token_id` - A mutable reference to the Erc20 contract.
258
+ /// * `erc721` - Write access to an [`Erc721`] contract.
287
259
///
288
260
/// # Errors
289
261
///
@@ -406,8 +378,9 @@ mod tests {
406
378
assert_eq ! ( contract. sender( alice) . underlying( ) , erc721_address) ;
407
379
}
408
380
381
+ // TODO: motsu should revert on calling a function that doesn't exist at
382
+ // specified address.
409
383
#[ motsu:: test]
410
- // TODO: motsu should not panic on this test
411
384
#[ ignore]
412
385
fn deposit_for_reverts_when_unsupported_token (
413
386
contract : Contract < Erc721WrapperTestExample > ,
@@ -423,7 +396,7 @@ mod tests {
423
396
let err = contract
424
397
. sender ( alice)
425
398
. deposit_for ( alice, token_ids. clone ( ) )
426
- . motsu_expect_err ( "should return Error::InvalidUnderlying " ) ;
399
+ . motsu_expect_err ( "should return Error::UnsupportedToken " ) ;
427
400
428
401
assert ! ( matches!(
429
402
err,
@@ -776,8 +749,10 @@ mod tests {
776
749
) ;
777
750
}
778
751
752
+ // TODO: motsu should revert on calling a function that doesn't exist at
753
+ // specified address.
779
754
#[ motsu:: test]
780
- #[ ignore] // TODO: issue in motsu
755
+ #[ ignore]
781
756
fn recover_reverts_when_invalid_token (
782
757
contract : Contract < Erc721WrapperTestExample > ,
783
758
alice : Address ,
0 commit comments