-
Notifications
You must be signed in to change notification settings - Fork 478
Open
Labels
A-ink_lang[ink_lang] Work item[ink_lang] Work itemB-feature-requestA request for a new feature.A request for a new feature.
Description
Since contract_ref! macro produces the "access trait" with the exact same method signatures as the ones on the original contract, sometimes it puts too strong of requirements on self on the caller's side.
Consider the following case:
let mut psp22_ref: ink::contract_ref!(PSP22) = (*reward_token).into();
let balance: Balance = psp22_ref.balance_of(Self::env().account_id());
if balance > 0 {
psp22_ref.transfer(running.owner, balance)?;
}compiler requires that psp22_ref is mut because PSP22::transfer(&mut self, ...). Even though it should not be necessary on the call side since psp22_ref is just an address and not an actual contract state.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
A-ink_lang[ink_lang] Work item[ink_lang] Work itemB-feature-requestA request for a new feature.A request for a new feature.