I need to call a function from another contract, but is it possible that the caller is the calling contract, and not msg.sender/wallet?
For example
contract BrainGame {
function updateGameScores(uint _scores, address _user) public onlyAdmin {
userScores[_user] = _scores;
}
}
The onlyAdmin
modifier is defined in the contract, and the UserPlay
contract is added as an Admin (which could update the scores)
contract UserPlay {
BrainGame bg = BrainGame(0x000ContractAddress000);
function playGame(uint _fun) public {
/// game logic goes
bg.updateGameScores(_fun, msg.sender);
}
}
My question is, can updateGameScores
function be called by UserPlay
instead of wallet/msg.sender?
Can we call a function (from another contract) and caller be the calling contract (instead of wallet/msg.sender)?
Thanks.