0

I have this situation.

I need to call a function in smart contract from another smart contract, but call has to come from a personal address because this address is only authorised to make this call. I can't use tools like metamask or truffle to do that. I have private key of this address. How do I invoke this kind of transaction from another smart contract. I understand that this transaction would have be signed first using private key and then placed in the smart contract. But how do I execute this transaction so the called contract sees as a caller the personal address not the smart contract calling it?

4
  • I don't think you wan wrape "msg.senger" from an EOA account into a smart contract function. If you call a function with a smart contract, msg.sender will be your contract. Maybe if there is a way to "whitelist" your smart contract address so it can act like your EOA ?
    – GrindCode
    Commented Jul 14, 2021 at 16:19
  • The only account which can call the function in another contract is the personal address, but this call can't be initiated by the owner, that's why I thought of a way to do it from second smart contract.
    – Bogdan
    Commented Jul 14, 2021 at 17:25
  • if you sing a transaction with a private key, msg.Sender is always the one that signed the transaction. so i don't think there is a way to delegate the call to an other smart contract. why can't the owner do the call ? Commented Jul 14, 2021 at 19:04
  • The personal account should be only funded when it needs to execute the transaction in another contract. The funding of the personal account has to occur in the same transaction as the call to the second contract after it has been funded. So in short, I want to accomplish two actions in this one contract call. If you can think of any other way of accomplishing this, let me know.
    – Bogdan
    Commented Jul 14, 2021 at 19:37

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.