How to use third party contract to send ERC token?

0 votes

I want to send ERC721 tokens using a third-party contract that I have and I trying to do it with the following code but I know it’s not right. How to do it?

pragma solidity ^0.4.24;

import "../../SuperERC721Token.sol";

contract MyContract {

    SuperERC721Token internal externalToken;

    constructor(address address) public {

        externalToken = SuperERC721Token(address);


    function ThirdPartyTransfer(string hashedTRX) public {; // this function allow the contract to send an ERC721 token to another address


Aug 10, 2018 in Blockchain by digger
• 27,620 points

1 answer to this question.

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.
0 votes

You can do it by using a code similar to the example mentioned below:

interface ERC721 /* is ERC165 */ {

    event Transfer(address indexed _from, address indexed _to, uint256 indexed _tokenId);

    event Approval(address indexed _owner, address indexed _approved, uint256 indexed _tokenId);

    event ApprovalForAll(address indexed _owner, address indexed _operator, bool _approved);

    function balanceOf(address _owner) external view returns (uint256);

    function ownerOf(uint256 _tokenId) external view returns (address);  

    function safeTransferFrom(address _from, address _to, uint256 _tokenId, bytes data) external payable;

    function safeTransferFrom(address _from, address _to, uint256 _tokenId) external payable;

    function transferFrom(address _from, address _to, uint256 _tokenId) external payable;

    function approve(address _approved, uint256 _tokenId) external payable;

    function setApprovalForAll(address _operator, bool _approved) external;

    function getApproved(uint256 _tokenId) external view returns (address);

    function isApprovedForAll(address _owner, address _operator) external view returns (bool);


interface ERC165 {

    function supportsInterface(bytes4 interfaceID) external view returns (bool);


interface ERC721TokenReceiver {

    function onERC721Received(address _operator, address _from, uint256 _tokenId, bytes _data) external returns(bytes4);


And in the contract that you want to call functionA, you add this code:

SuperERC721Token erc721Token= ERC721Token(0x0000000000000000000000000000000000000000); //Replace 0x000000000000000000000000000000000000000 with the address of SuperERC721Token

answered Aug 10, 2018 by slayer
• 29,040 points

Related Questions In Blockchain

0 votes
1 answer

How do I send back ethers to the sender of the tokens in a smart contract?

Whenever a smart contract receives ether via ...READ MORE

answered May 30, 2018 in Blockchain by Perry
• 16,450 points
+1 vote
1 answer

How to write an ERC 721 contract?

You could go through the following links:  https://github. ...READ MORE

answered Jun 28, 2018 in Blockchain by Perry
• 16,450 points
0 votes
1 answer

How to use real world/live data in my smart contract?

You cant access/embed real world data using ...READ MORE

answered Jul 12, 2018 in Blockchain by digger
• 27,620 points
0 votes
1 answer

How to send ethers to a contract?

Transfer of tokens means you will deduct ...READ MORE

answered Jul 25, 2018 in Blockchain by charlie_brown
• 7,710 points
0 votes
1 answer

Truffle tests not running after truffle init

This was a bug. They've fixed it. ...READ MORE

answered Sep 11, 2018 in Blockchain by Christine
• 15,790 points
+1 vote
3 answers

Removing double quotes from a string from JSON response in PHP

Just remove the json_encode call, and it should work: $resp ...READ MORE

answered Sep 12, 2018 in Blockchain by digger
• 27,620 points
0 votes
1 answer

How to store photos in Hyperledger smart contract?

To do this, you need to represent ...READ MORE

answered Jul 9, 2018 in Blockchain by slayer
• 29,040 points

© 2018 Brain4ce Education Solutions Pvt. Ltd. All rights Reserved.
"PMP®","PMI®", "PMI-ACP®" and "PMBOK®" are registered marks of the Project Management Institute, Inc. MongoDB®, Mongo and the leaf logo are the registered trademarks of MongoDB, Inc.