How can we get transaction information

What is the chain name?

Rinkeby Testnet Network

There are no events for this contract address. Thats the reason it did not sync any.
https://rinkeby.etherscan.io/address/0xf6b0599780bbf43489bfc863A3d6F194119bCdD2#events

But I have transactions, then how can I get events ?

https://s13raf28z2ju.usemoralis.com:2053/server

As per your contract code, Approval events are emitted in the _approve function. So when you call the _approve function you get a new Approval event.

What should I do now ?

As per the etherscan both your transactions are failed due to less gas. Maybe run a new transaction with enough gas and add an emit event in the function which you are calling.

// SPDX-License-Identifier: Unlicense

pragma solidity ^0.8.4;

import “@openzeppelin/[email protected]/token/ERC721/extensions/ERC721Enumerable.sol”;

import “@openzeppelin/[email protected]/token/ERC721/extensions/ERC721URIStorage.sol”;

import “@openzeppelin/[email protected]/token/ERC721/extensions/IERC721Metadata.sol”;

import “@openzeppelin/[email protected]/token/ERC721/ERC721.sol”;

import “@openzeppelin/[email protected]/utils/math/SafeMath.sol”;

contract trans is ERC721, ERC721Enumerable, ERC721URIStorage{

    function _beforeTokenTransfer(address from, address to, uint256 tokenId)

    internal

    override(ERC721, ERC721Enumerable)

{

    super._beforeTokenTransfer(from, to, tokenId);

}

function _burn(uint256 tokenId) internal override(ERC721, ERC721URIStorage){

    super._burn(tokenId);

}

function supportsInterface(bytes4 interfaceId)

    public

    view

    override(ERC721, ERC721Enumerable)

    returns (bool)

{

    return super.supportsInterface(interfaceId);

}

function tokenURI(uint256 tokenId)

    public

    view

    override(ERC721, ERC721URIStorage)

    returns (string memory)

{

    return super.tokenURI(tokenId);

}

    constructor() ERC721("YTMinter", "YTM")  {}

    function get() public payable {

           string memory _link = "https://ipfs.io/ipfs/QmRsYWdpykpcsiC1YELHnJDepAdk1kqpg9rQ6ipEzYRywA";

           mint(_link);

    }

    function mint(string memory _uri) public {

            uint256 mintIndex = totalSupply();

            _safeMint(msg.sender, mintIndex);

            _setTokenURI(mintIndex, _uri);

    }

    //function name() external view returns (string name);

}

where to add emit what to write ?

there are 3 transactions out of which 1 is done properly, then that transaction should be visble.

First transaction is of the contract creation. It does not emit any event.

Check this tutorial on how to add an event in the contract and how to emit and event.

// SPDX-License-Identifier: Unlicense

pragma solidity ^0.8.4;

import “@openzeppelin/[email protected]/token/ERC721/extensions/ERC721Enumerable.sol”;

import “@openzeppelin/[email protected]/token/ERC721/extensions/ERC721URIStorage.sol”;

import “@openzeppelin/[email protected]/token/ERC721/ERC721.sol”;

import “@openzeppelin/[email protected]/utils/math/SafeMath.sol”;

contract MyToken is ERC721, ERC721Enumerable, ERC721URIStorage {

using SafeMath for uint256;

uint public constant mintPrice=0;

//

event transa (

    address _from, address _to, uint256 _value

);

//

function _beforeTokenTransfer(address from, address to, uint256 tokenId) internal override(ERC721, ERC721Enumerable)

{

    super._beforeTokenTransfer(from, to, tokenId);

}

function _burn(uint256 tokenId) internal override(ERC721, ERC721URIStorage)

{

    super._burn(tokenId);

}

function supportsInterface(bytes4 interfaceId) public view override(ERC721, ERC721Enumerable) returns (bool)

{

    return super.supportsInterface(interfaceId);

}

function tokenURI(uint256 tokenId) public view override(ERC721, ERC721URIStorage) returns (string memory)

{

    return super.tokenURI(tokenId);

}

constructor() ERC721("YTMinter", "YTM")  {}

function mint(string memory _uri, address _to, uint256 _value) public payable{

    emit transa (msg.sender, _to, msg.value);

    uint256 mintIndex = totalSupply();

    _safeMint(msg.sender, mintIndex);

    _setTokenURI(mintIndex, _uri);

           

}

}

I am emiting but I am not getting any logs.
what is wrong ?

I am getting events then also I am not getting in moralis. in this code I didn’t used event and emit

You mean you are able to find the events on etherscan but not receiving any data through event sync?

Can you share the contract address, event abi and chain name which you used to sync. I will test it from my side.

The code of solidtity where I am not able to create events, but I am able to make contract on etherscan using this code.

The code of solidtity where I am able to create events, but I am not able to make contract on etherscan using this code.

contract address - 0x5aB060Ed9e7F67a74F540c7a2E219AC4BC65b0F6
Please check, I have created the table but I am not getting my transactions in database.

As per your server logs, it seems that you have added the sync on ethereum chain.

You need to use the testnet server to sync events from rinkeby chain.

I have used mainnet server in moralis, so i need to use testnet server ?
Am I right ?

Yes, you are right.
With mainnet server you can only sync mainnet transactions/events to database.

1 Like

ok will try it out
thanks for replying me always