gelbplaneten
gelbplaneten

Reputation: 21

Ethereum. Is there any way to notify about contract creation?

When I publish a new smart contract to the Ethereum blockchain, I want to notify another contract about it. Is there any option to do that? For example, to send transaction automatically when contract reaches the blockchain.

Upvotes: 2

Views: 472

Answers (2)

Chevdor
Chevdor

Reputation: 771

So lets call E your existing contract. Ensure it has a method that we can call notify for instance. When you create your new contract, from the constructor (called when it gets deployed) then call the notify method of E.

Upvotes: 0

Rob Hitchens
Rob Hitchens

Reputation: 1059

No, but Yes.

It wouldn't be possible to notify a contract about any contract created, and I don't see an obvious way to notify about all contracts created by a specific user.

But, there's a way to notify a contract about all instances of a certain species of contract. I suspect this is a reasonable assumption, because the interested contract is probably only interested in a certain type(s) of contract.

You would implement a factory pattern and get it to deploy the instances. The function that does the deployment would be responsible for required notifications.

Hope it helps.

Upvotes: 1

Related Questions