Sync and watch address with event

I have been following this tutorial.

[https://moralis.io/how-to-build-a-cross-chain-bridge/]
(https://moralis.io/how-to-build-a-cross-chain-bridge/)

Main bridge smart contract is emitting the event. Refer the transaction.

https://testnet.bscscan.com/tx/0x3c630ee6f7d82e27c73045bfc84aba06b7a91ef5f537fd969da0f765c30c4305#eventlog

I have configured Sync and Watch Contract Events in moralis admin page.

But the sync is not happening in dashboard as well as the code after the event, is not executing because of this. how to solve
Thanks

You have to use uint256 instead of uint in topic

Changed it, not solved.
thanks for swift support.

you can use the topic in the form of topic0 hash that you find in the block explorer

you can also paste the server url

This is the topic hash.

  • 0 0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef
  • 1 0x0000000000000000000000007a717e1b64a6a3069fdadba4ccf5f9d0933f73da
  • 2 0x0000000000000000000000007e327cadc2857ff300538d93bfab0584ee569bf0

this is the server url
https://n86imwgbmsoa.usemoralis.com:2053/server

Can you format it and where do i paste? in topic field?

You paste directly that hash for topic0 for the entire topic field, it has to be only that sting that is a hash

I can look a little later at the server.
You can try to update it in case that it isn’t latest version.

hash of topic 0 Pasted in entire topic field,

0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef
not solved.

server is updated one 0.0.359.

I tried to fix that event, didn’t manage to do it, it looks like the transaction that you pasted is from a different smart contract, after changing the address to the one from that event it looks like the abi is not the correct one

Hi cryptokid.
It solved. I have started the process from zero. and the event sync is working now. I think the problem was with ABI.

I have a new issue. the process should be started in after save function in cloud. even though the transfer happens in dapp, control never reach aftersave function. Note i am logging it but the message did not come. What could be the reason?
Thank you

Moralis.Cloud.afterSave(“ETHTokenTransfers”, (request) => {
logger.info(“inside cloud.aftersave”);
const data = JSON.parse(JSON.stringify(request.object, [“token_address”, “to_address”, “from_address”,“transaction_hash”,“value”, “confirmed”]));
logger.info(data);
if (data[“token_address”] == mainToken_address.toLocaleLowerCase() && data[“to_address”] == MainBridge_address.toLocaleLowerCase() && !data[“confirmed”]) {
const txlock = processBridgeRequestLock(data);
const txbridge = processBridgeRequestBridge(data);
}
else{
logger.info(“transaction not related to bridge”);
}

Same here. Seems like the object property is inaccessible

logger.info("EthTokenTransfers");
logger.info(`Request: ${JSON.stringify(request)}`);
logger.info(`Request object: ${JSON.stringify(request.object)}`);
logger.info(`Token Address: ${request.object.token_address}`);
logger.info(`To Address: ${request.object.to_address}`);

Cant seems to access request.object.

Request.object seems to work.

You may need to use a different syntax to access its keys/values. You can try .get and [] also

I tried request.object[“token_address”] and it is still undefined. Let me try with .get