As I was explaining in your original question I have msg.sender issue there is no such functionality as "call contract with tokens". Tokens are not transferred as part of a call between contracts, they are only transferred by calling the token contract's own transfer
(or transferFrom
) function.
The problem with token transfers in general is that the contract which receives the tokens has no way of knowing when and if he has received tokens. The only way to know is for the contract to check his own token balance from the token contract but somebody has to trigger the functionality which starts the checking process.
So it could work something like this:
1) User doesn't have tokens and calls A
2) A uses the token contract's transfer
function to transfer tokens to B
3) A calls some function in B such as iHaveGivenYouTokens
4) B receives a call to iHaveGivenYouTokens
from A and checks his balance from the token contract
5) Seeing that his balance has increased, B performs the service
I'm not sure what you mean with sentences "B is very regular and simple standard contract" and "can any contract be interacted with A". B is not "regular" contract and it doesn't follow any standards - it's a specialized contract which you need to implement. And for the second quote: it's all up to you. If you allow any contract or user to interact with your contracts then that's possible. Or you can restrict access to the contracts based on address for example.