You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Some contracts need to call another contracts, e.g. Erc721::_check_on_erc721_received.
We want to be able to mock some behaviour, or at least mock return data in motsu unit tests.
pubfn_check_on_erc721_received(&mutself,operator:Address,from:Address,to:Address,token_id:U256,data:Bytes,) -> Result<(),Error>{constRECEIVER_FN_SELECTOR:FixedBytes<4> = fixed_bytes!("150b7a02");if !to.has_code(){returnOk(());}let receiver = IERC721Receiver::new(to);let call = Call::new_in(self);let result = receiver.on_erc_721_received(
call,
operator,
from,
token_id,
data.to_vec().into(),);let id = match result {Ok(id) => id,Err(e) => {iflet call::Error::Revert(ref reason) = e {if reason.len() > 0{// Non-IERC721Receiver implementer.returnErr(Error::InvalidReceiverWithReason(e));}}returnErr(ERC721InvalidReceiver{receiver: to }.into());}};// Token rejected.if id != RECEIVER_FN_SELECTOR{returnErr(ERC721InvalidReceiver{receiver: to }.into());}Ok(())}}
Contribution Guidelines
I agree to follow this project's Contribution Guidelines
The text was updated successfully, but these errors were encountered:
What is the feature you would like to see?
Some contracts need to call another contracts, e.g.
Erc721::_check_on_erc721_received
.We want to be able to mock some behaviour, or at least mock return data in
motsu
unit tests.Contribution Guidelines
The text was updated successfully, but these errors were encountered: