Account A
deploys Contract A
. Account A
then calls Contract B
function register
, passing the address of Contract A
. Is it possible to prove that Account A
deployed Contract A
from within the register function of Contract B
without implementing some kind of proof of deployment function in Contract A
?
Contract A
Deployed by Account A
. The contract contains no record of Account A
in storage.
Contract B
Account A
then calls this function passing the Contract A
address.
pub fn register(
&mut self,
dapp_account: AccountId,
) -> Result<(), Error> {
let caller = self.env().caller();
// check that the dapp_account is a contract
if !self.env().is_contract(&dapp_account) {
return Err(Error::InvalidContract);
}
// prove that the caller deployed `dapp_account`
// ?? check the contracts.instantiateWithCode extrinsic plus a merkle trie proof of the block inclusion on-chain?
I'm assuming this would require the contract instantiate extrinsic, a proof of the extrinsic being in a block, and a proof of the block being on-chain.