Hi,
You can do something like this:
For example to find this transaction (https://etherscan.io/tx/0xcc6e357f503581e71f0e9c3240564916ac4827b7c805848626dd8224bd49a303) that created 0x0990faeff7fa89dd42a4c645b2aba0b209f06fa6
smart contract you can get the logs for this smart contract specific to OwnershipTransferred (index_topic_1 address previousOwner, index_topic_2 address newOwner)
event with:
https://deep-index.moralis.io/api/v2/0x0990faeff7fa89dd42a4c645b2aba0b209f06fa6/logs?chain=eth&topic0=0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0
I added as topic0 the topic specific to that OwnershipTransferred function call so that you donāt get all the logs for that smart contract, and as a result youāll have that exact transaction hash that created that smart contract:
{
"total": 1,
"page": 0,
"page_size": 500,
"result": [
{
"transaction_hash": "0xcc6e357f503581e71f0e9c3240564916ac4827b7c805848626dd8224bd49a303",
"address": "0x0990faeff7fa89dd42a4c645b2aba0b209f06fa6",
"block_timestamp": "2021-10-22T03:37:11.000Z",
"block_number": "13465110",
"block_hash": "0x2c1ee487e636ad0b42fb64f78dcf3ddd2269c6bbd351151f28b15f9453927223",
"data": "0x",
"topic0": "0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0",
"topic1": "0x0000000000000000000000000000000000000000000000000000000000000000",
"topic2": "0x0000000000000000000000005ca6d67b24083e520996546254da58d08726f96c",
"topic3": null
}
]
}
and you can do the same directly from Moralis SDK with:
const options = {
address: "0x0990faeff7fa89dd42a4c645b2aba0b209f06fa6",
chain: "eth",
topic0: "0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0"
};
t = await Moralis.Web3API.native.getLogsByAddress(options);