I'm writing a contract for secret network in the cosmwasm ecosystem using rust. Below mentioned is a function that is giving an error. Its a callback message that is called whenever a contract receives an nft
#[allow(clippy::too_many_arguments)]
fn receiver_callback_msgs<S: Storage, A: Api, Q: Querier>(
deps: &mut Extern<S, A, Q>,
env: &Env,
contract_human: &HumanAddr,
contract: &CanonicalAddr,
receiver_info: Option<ReceiverInfo>,
send_from_list: Vec<SendFrom>,
msg: &Option<Binary>,
sender: &HumanAddr,
receivers: &mut Vec<CacheReceiverInfo>,
) -> StdResult<Vec<CosmosMsg>> {
let (code_hash, impl_batch) = if let Some(supplied) = receiver_info {
(
supplied.recipient_code_hash,
supplied.also_implements_batch_receive_nft.unwrap_or(false),
)
} else if let Some(receiver) = receivers.iter().find(|&r| r.contract == *contract) {
(
receiver.registration.code_hash.clone(),
receiver.registration.impl_batch,
)
} else {
let store = ReadonlyPrefixedStorage::new(PREFIX_RECEIVERS, &deps.storage);
let registration: ReceiveRegistration =
may_load(&store, contract.as_slice())?.unwrap_or(ReceiveRegistration {
code_hash: String::new(),
impl_batch: false,
});
let receiver = CacheReceiverInfo {
contract: contract.clone(),
registration: registration.clone(),
};
receivers.push(receiver);
(registration.code_hash, registration.impl_batch)
};
if code_hash.is_empty() {
return Ok(Vec::new());
}
let mut callbacks: Vec<CosmosMsg> = Vec::new();
for send_from in send_from_list.into_iter() {
// if BatchReceiveNft is implemented, use it
if impl_batch {
callbacks.push(try_receive(
&mut deps,
sender.clone(),
send_from.owner,
&send_from.token_ids,
msg.clone(),
code_hash.clone(),
// contract_human.clone(),
)?);
}
}
Ok(callbacks)
}
which returns the error:
I am new to rust so need some help in resolving this
this is try_receive signature
pub fn try_receive<S: Storage, A: Api, Q: Querier>(
deps: &mut Extern<S, A, Q>,
sender: HumanAddr,
from: HumanAddr,
token_ids: &[String],
msg: Option<Binary>,
code_hash: String,
) -> HandleResult
