Hi,
I have an issue I haven’t got before, which looks like a bug. Identical code to what’s running on 2 other Moralis projects and fails on this new one.
I am creating contract event syncs via code in a Job (see code below).
Every call to Moralis.Cloud.run("watchContractEvent", the_event_data, {useMasterKey:true}))
returns {"success":true}
I can see the sync in Moralis Admin > View Details -> Sync.
However, I have nothing in the database.
I have rebooted the server, waited for over 2h, it’s just not syncing.
I have tried using both roundCreated(uint256, string, uint256, uint256, uint256, address, uint256, uint256)
and web3.utils.sha3("roundCreated(uint256, string, uint256, uint256, uint256, address, uint256, uint256)")
as the topic, to the same result. The syncs are showing in the list, not in the DB.
Here is my code (21 events on 3 BSC Testnet contracts)
Moralis.Cloud.job("startSync", async function (request) {
var events = [
{
"chainId": "0x61",
"address": "0x8F3BC4cAdf3d6CF97e5D0775aEC8E985B5207B69",
"topic": "feeChanged(uint256, uint256, uint256, uint256)",
"abi": {
"anonymous": false,
"inputs": [
{
"indexed": false,
"internalType": "uint256",
"name": "creationFees",
"type": "uint256"
},
{
"indexed": false,
"internalType": "uint256",
"name": "referralFees",
"type": "uint256"
},
{
"indexed": false,
"internalType": "uint256",
"name": "creatorFees",
"type": "uint256"
},
{
"indexed": false,
"internalType": "uint256",
"name": "roundFees",
"type": "uint256"
}
],
"name": "feeChanged",
"type": "event"
},
"limit": 500000,
"tableName": "feeChanged",
"sync_historical": true
},
{
"chainId": "0x61",
"address": "0x8F3BC4cAdf3d6CF97e5D0775aEC8E985B5207B69",
"topic": "newBet(uint256, uint256, uint8, address)",
"abi": {
"anonymous": false,
"inputs": [
{
"indexed": false,
"internalType": "uint256",
"name": "round_id",
"type": "uint256"
},
{
"indexed": false,
"internalType": "uint256",
"name": "amount",
"type": "uint256"
},
{
"indexed": false,
"internalType": "uint8",
"name": "direction",
"type": "uint8"
},
{
"indexed": false,
"internalType": "address",
"name": "user",
"type": "address"
}
],
"name": "newBet",
"type": "event"
},
"limit": 500000,
"tableName": "newBet",
"sync_historical": true
},
{
"chainId": "0x61",
"address": "0x8F3BC4cAdf3d6CF97e5D0775aEC8E985B5207B69",
"topic": "newReferral(uint256, address, address, uint256)",
"abi": {
"anonymous": false,
"inputs": [
{
"indexed": false,
"internalType": "uint256",
"name": "roundId",
"type": "uint256"
},
{
"indexed": false,
"internalType": "address",
"name": "user",
"type": "address"
},
{
"indexed": false,
"internalType": "address",
"name": "referrer",
"type": "address"
},
{
"indexed": false,
"internalType": "uint256",
"name": "feesEarned",
"type": "uint256"
}
],
"name": "newReferral",
"type": "event"
},
"limit": 500000,
"tableName": "newReferral",
"sync_historical": true
},
{
"chainId": "0x61",
"address": "0x8F3BC4cAdf3d6CF97e5D0775aEC8E985B5207B69",
"topic": "newReferralFees(uint256, address, address, uint256)",
"abi": {
"anonymous": false,
"inputs": [
{
"indexed": false,
"internalType": "uint256",
"name": "roundId",
"type": "uint256"
},
{
"indexed": false,
"internalType": "address",
"name": "user",
"type": "address"
},
{
"indexed": false,
"internalType": "address",
"name": "referrer",
"type": "address"
},
{
"indexed": false,
"internalType": "uint256",
"name": "feesEarned",
"type": "uint256"
}
],
"name": "newReferralFees",
"type": "event"
},
"limit": 500000,
"tableName": "newReferralFees",
"sync_historical": true
},
{
"chainId": "0x61",
"address": "0x8F3BC4cAdf3d6CF97e5D0775aEC8E985B5207B69",
"topic": "ownershipChanged(address)",
"abi": {
"anonymous": false,
"inputs": [
{
"indexed": false,
"internalType": "address",
"name": "newOwner",
"type": "address"
}
],
"name": "ownershipChanged",
"type": "event"
},
"limit": 500000,
"tableName": "ownershipChanged",
"sync_historical": true
},
{
"chainId": "0x61",
"address": "0x8F3BC4cAdf3d6CF97e5D0775aEC8E985B5207B69",
"topic": "paused(string)",
"abi": {
"anonymous": false,
"inputs": [
{
"indexed": false,
"internalType": "string",
"name": "reason",
"type": "string"
}
],
"name": "paused",
"type": "event"
},
"limit": 500000,
"tableName": "paused",
"sync_historical": true
},
{
"chainId": "0x61",
"address": "0x8F3BC4cAdf3d6CF97e5D0775aEC8E985B5207B69",
"topic": "resumed()",
"abi": {
"anonymous": false,
"inputs": [],
"name": "resumed",
"type": "event"
},
"limit": 500000,
"tableName": "resumed",
"sync_historical": true
},
{
"chainId": "0x61",
"address": "0x8F3BC4cAdf3d6CF97e5D0775aEC8E985B5207B69",
"topic": "roundCanceled(uint256, address)",
"abi": {
"anonymous": false,
"inputs": [
{
"indexed": false,
"internalType": "uint256",
"name": "round_id",
"type": "uint256"
},
{
"indexed": false,
"internalType": "address",
"name": "canceledBy",
"type": "address"
}
],
"name": "roundCanceled",
"type": "event"
},
"limit": 500000,
"tableName": "roundCanceled",
"sync_historical": true
},
{
"chainId": "0x61",
"address": "0x8F3BC4cAdf3d6CF97e5D0775aEC8E985B5207B69",
"topic": "roundCreated(uint256, string, uint256, uint256, uint256, address, uint256, uint256)",
"abi": {
"anonymous": false,
"inputs": [
{
"indexed": false,
"internalType": "uint256",
"name": "round_id",
"type": "uint256"
},
{
"indexed": false,
"internalType": "string",
"name": "pair",
"type": "string"
},
{
"indexed": false,
"internalType": "uint256",
"name": "start_time",
"type": "uint256"
},
{
"indexed": false,
"internalType": "uint256",
"name": "bet_time",
"type": "uint256"
},
{
"indexed": false,
"internalType": "uint256",
"name": "duration",
"type": "uint256"
},
{
"indexed": false,
"internalType": "address",
"name": "creator",
"type": "address"
},
{
"indexed": false,
"internalType": "uint256",
"name": "minBetValue",
"type": "uint256"
},
{
"indexed": false,
"internalType": "uint256",
"name": "creationFees",
"type": "uint256"
}
],
"name": "roundCreated",
"type": "event"
},
"limit": 500000,
"tableName": "roundCreated",
"sync_historical": true
},
{
"chainId": "0x61",
"address": "0x8F3BC4cAdf3d6CF97e5D0775aEC8E985B5207B69",
"topic": "roundEnded(uint256, uint256, uint256, uint256, uint256)",
"abi": {
"anonymous": false,
"inputs": [
{
"indexed": false,
"internalType": "uint256",
"name": "round_id",
"type": "uint256"
},
{
"indexed": false,
"internalType": "uint256",
"name": "creatorFees",
"type": "uint256"
},
{
"indexed": false,
"internalType": "uint256",
"name": "roundFees",
"type": "uint256"
},
{
"indexed": false,
"internalType": "uint256",
"name": "price",
"type": "uint256"
},
{
"indexed": false,
"internalType": "uint256",
"name": "priceTimestamp",
"type": "uint256"
}
],
"name": "roundEnded",
"type": "event"
},
"limit": 500000,
"tableName": "roundEnded",
"sync_historical": true
},
{
"chainId": "0x61",
"address": "0x8F3BC4cAdf3d6CF97e5D0775aEC8E985B5207B69",
"topic": "roundStarted(uint256, uint256, uint256)",
"abi": {
"anonymous": false,
"inputs": [
{
"indexed": false,
"internalType": "uint256",
"name": "round_id",
"type": "uint256"
},
{
"indexed": false,
"internalType": "uint256",
"name": "price",
"type": "uint256"
},
{
"indexed": false,
"internalType": "uint256",
"name": "priceTimestamp",
"type": "uint256"
}
],
"name": "roundStarted",
"type": "event"
},
"limit": 500000,
"tableName": "roundStarted",
"sync_historical": true
},
{
"chainId": "0x61",
"address": "0xd170368b3F593F8EfcA56AE8Fd77E4976397a71a",
"topic": "escrowCanceled(address, uint256)",
"abi": {
"anonymous": false,
"inputs": [
{
"indexed": false,
"internalType": "address",
"name": "escrow_owner",
"type": "address"
},
{
"indexed": false,
"internalType": "uint256",
"name": "escrow_id",
"type": "uint256"
}
],
"name": "escrowCanceled",
"type": "event"
},
"limit": 500000,
"tableName": "escrowCanceled",
"sync_historical": true
},
{
"chainId": "0x61",
"address": "0xd170368b3F593F8EfcA56AE8Fd77E4976397a71a",
"topic": "escrowClosed(address, uint256)",
"abi": {
"anonymous": false,
"inputs": [
{
"indexed": false,
"internalType": "address",
"name": "escrow_owner",
"type": "address"
},
{
"indexed": false,
"internalType": "uint256",
"name": "escrow_id",
"type": "uint256"
}
],
"name": "escrowClosed",
"type": "event"
},
"limit": 500000,
"tableName": "escrowClosed",
"sync_historical": true
},
{
"chainId": "0x61",
"address": "0xd170368b3F593F8EfcA56AE8Fd77E4976397a71a",
"topic": "newAccount(address, string)",
"abi": {
"anonymous": false,
"inputs": [
{
"indexed": false,
"internalType": "address",
"name": "user",
"type": "address"
},
{
"indexed": false,
"internalType": "string",
"name": "account",
"type": "string"
}
],
"name": "newAccount",
"type": "event"
},
"limit": 500000,
"tableName": "newAccount",
"sync_historical": true
},
{
"chainId": "0x61",
"address": "0xd170368b3F593F8EfcA56AE8Fd77E4976397a71a",
"topic": "newCredit(address, address, uint256, string, string)",
"abi": {
"anonymous": false,
"inputs": [
{
"indexed": false,
"internalType": "address",
"name": "user",
"type": "address"
},
{
"indexed": false,
"internalType": "address",
"name": "from",
"type": "address"
},
{
"indexed": false,
"internalType": "uint256",
"name": "amount",
"type": "uint256"
},
{
"indexed": false,
"internalType": "string",
"name": "account",
"type": "string"
},
{
"indexed": false,
"internalType": "string",
"name": "note",
"type": "string"
}
],
"name": "newCredit",
"type": "event"
},
"limit": 500000,
"tableName": "newCredit",
"sync_historical": true
},
{
"chainId": "0x61",
"address": "0xd170368b3F593F8EfcA56AE8Fd77E4976397a71a",
"topic": "newDebit(address, uint256, string, string)",
"abi": {
"anonymous": false,
"inputs": [
{
"indexed": false,
"internalType": "address",
"name": "user",
"type": "address"
},
{
"indexed": false,
"internalType": "uint256",
"name": "amount",
"type": "uint256"
},
{
"indexed": false,
"internalType": "string",
"name": "account",
"type": "string"
},
{
"indexed": false,
"internalType": "string",
"name": "note",
"type": "string"
}
],
"name": "newDebit",
"type": "event"
},
"limit": 500000,
"tableName": "newDebit",
"sync_historical": true
},
{
"chainId": "0x61",
"address": "0xd170368b3F593F8EfcA56AE8Fd77E4976397a71a",
"topic": "newEscrow(address, uint256)",
"abi": {
"anonymous": false,
"inputs": [
{
"indexed": false,
"internalType": "address",
"name": "escrow_owner",
"type": "address"
},
{
"indexed": false,
"internalType": "uint256",
"name": "escrow_id",
"type": "uint256"
}
],
"name": "newEscrow",
"type": "event"
},
"limit": 500000,
"tableName": "newEscrow",
"sync_historical": true
},
{
"chainId": "0x61",
"address": "0xd170368b3F593F8EfcA56AE8Fd77E4976397a71a",
"topic": "newTransfer(address, address, uint256, string, string, string)",
"abi": {
"anonymous": false,
"inputs": [
{
"indexed": false,
"internalType": "address",
"name": "from",
"type": "address"
},
{
"indexed": false,
"internalType": "address",
"name": "to",
"type": "address"
},
{
"indexed": false,
"internalType": "uint256",
"name": "amount",
"type": "uint256"
},
{
"indexed": false,
"internalType": "string",
"name": "fromAccount",
"type": "string"
},
{
"indexed": false,
"internalType": "string",
"name": "toAccount",
"type": "string"
},
{
"indexed": false,
"internalType": "string",
"name": "note",
"type": "string"
}
],
"name": "newTransfer",
"type": "event"
},
"limit": 500000,
"tableName": "newTransfer",
"sync_historical": true
},
{
"chainId": "0x61",
"address": "0xca1d020319EC1BFf60b8c445DA3e95BfEb549F82",
"topic": "byeAdmin(address)",
"abi": {
"anonymous": false,
"inputs": [
{
"indexed": false,
"internalType": "address",
"name": "admin",
"type": "address"
}
],
"name": "byeAdmin",
"type": "event"
},
"limit": 500000,
"tableName": "byeAdmin",
"sync_historical": true
},
{
"chainId": "0x61",
"address": "0xca1d020319EC1BFf60b8c445DA3e95BfEb549F82",
"topic": "newAdmin(address)",
"abi": {
"anonymous": false,
"inputs": [
{
"indexed": false,
"internalType": "address",
"name": "admin",
"type": "address"
}
],
"name": "newAdmin",
"type": "event"
},
"limit": 500000,
"tableName": "newAdmin",
"sync_historical": true
}
]
const logger = Moralis.Cloud.getLogger();
var i;
var l = events.length;
logger.info("Events: "+l);
for (i=0;i<l;i++) {
logger.info(await Moralis.Cloud.run("watchContractEvent", events[i], {useMasterKey:true}));
}
return true;
});
No errors returned in the logs.
Any clue to what’s going on?
I don’t generate the event list manually, I have code that reads the ABI to generate that data from all the events found in the contract. That exact code was used, unmodified, on 2 other Moralis projects in the past, and it didn’t lead to that issue.
I have a paid plan, if that makes any difference.
Thanks.