so basically I created a smart contract in solidity which has features like
- deposit erc20 token
- withdraw er20 token
- balance of the user
- buyorder
- sellorder
It working as as expected with all the feature align..
But I want to divide it in two smart contract say contract users which will deal with
- deposit erc20 token
- withdraw er20 token
- balance of the user
and another contract say contract orders which will deal with 4. buyorder 5. sellorder
The problem I am facing is security concern. If someone put a buy/sell order his balance will be deduct/ credit. So how can I call a balanceOf function of the contract user to deduct/credit the funds to the address who called the function of the contract order.
** If I call the function of contract A from contract B, the msg.sender will be address of contract B.
If a address 0x1234 call the function buyorder in contractB, the functionB should call the balanceOf function of contract A and deduct the balance of the address 0x1234.