SKALE Chain to SKALE Chain ERC721 Transfer

As a SKALE chain Owner, there are two main steps to managing SKALE Chain to SKALE Chain (S2S) ERC721 transfer through IMA:

Once you have completed step 1 to setup ERC721 tokens with another chain, end-users can transfer ERC721 tokens between SKALE Chains.

Setup ERC721 S2S Transfers

The following one-time setup is required for SKALE Chains with a default access control policy (default settings are: whitelisting enabled, automatic deployment disabled). For more information on IMA access control, see here.

1. Connect each SKALE Chain

You must connect each chain in both directions by executing two connectSchain() transaction on each respective chain.

⇢ To connect the target chain to the origin chain, run connectSchain(targetSchainName) in TokenManagerLinker contract on the origin chain.

⇠ To connect the origin chain to the target chain, run connectSchain(originSchainName) in TokenManagerLinker contract on the target chain.

Only the REGISTRAR_ROLE in TokenManagerLinker may execute connectSchain. So you must be granted with this role on this contract.
  • IMA-JS

  • Web3 JS

// import & init ima-js here

export async function connectSchain(ima) {
    let address = "YOUR_ADDRESS";
    let privateKey = "YOUR_PRIVATE_KEY";

    let opts = {
        address: address,
        privateKey: privateKey // remove privateKey from txOpts to use Metamask signing
    };

    await ima.schain.tokenManagerLinker.connectSchain(schainName, opts);
}
const Web3 = require('web3');
const Tx = require('ethereumjs-tx').Transaction;

let schainABIs = require("[YOUR_SKALE_CHAIN_ABIs]");
let privateKey = Buffer.from('[YOUR_PRIVATE_KEY]', 'hex')
let account = "[YOUR_ACCOUNT_ADDRESS]";
let schainEndpoint = "[YOUR_SKALE_CHAIN_ENDPOINT]";
let chainId = "ORIGIN_CHAIN_ID";
let targetSchainName = "TARGET_SKALE_CHAIN_NAME";

const tokenManagerLinkerAddress = schainABIs.token_manager_linker_address;
const tokenManagerLinkerABI = schainABIs.token_manager_linker_abi;

const web3 = new Web3(new Web3.providers.HttpProvider(schainEndpoint));

let contract = new web3.eth.Contract(
  tokenManagerLinkerABI, 
  tokenManagerLinkerAddress
);

/* 
 * Prepare connectSchain
 */
let connectSchain = contract.methods.connectSchain(targetSchainName)
  .encodeABI();  

//get nonce
web3.eth.getTransactionCount(account).then((nonce) => {
  //create raw transaction
  const rawTx = {
    chainId: chainId,
    nonce: "0x" + nonce.toString(16),
    from: account, 
    nonce: "0x" + nonce.toString(16),
    data : connectSchain,
    to: tokenManagerLinkerAddress,
    gasPrice: 100000000000,
    gas: 8000000
  }

  //sign transaction
  const tx = new Tx(rawTx);
  tx.sign(privateKey);

  //serialize transaction
  const serializedTx = tx.serialize();

  //send signed transaction
  web3.eth.sendSignedTransaction('0x' + serializedTx.toString('hex')).
    on('receipt', receipt => {
      //record receipt to console
      console.log(receipt);
   }).
    catch(console.error);
});

2. Deploy ERC721 on Origin

Deploy your ERC721 contract on the Origin chain.

// SPDX-License-Identifier: MIT

pragma solidity 0.6.12;

import "@openzeppelin/contracts/token/ERC721/extensions/ERC721URIStorage.sol";
import "@openzeppelin/contracts/access/AccessControlEnumerable.sol";

contract ERC721Example is AccessControlEnumerable, ERC721URIStorage {

    bytes32 public constant MINTER_ROLE = keccak256("MINTER_ROLE");

    constructor(
        string memory contractName,
        string memory contractSymbol
    )
        ERC721(contractName, contractSymbol)
    {
        _setRoleAdmin(MINTER_ROLE, MINTER_ROLE);
        _setupRole(MINTER_ROLE, _msgSender());
    }

    function mint(address to, uint256 tokenId)
        external
        returns (bool)
    {
        require(hasRole(MINTER_ROLE, _msgSender()), "Sender is not a Minter");
        _mint(to, tokenId);
        return true;
    }
}

3. Deploy ERC721 clone on Target

The ERC721 clone on the target chain MUST have both mint and burn functionalities. If the original ERC721 contract on origin does not have burn functionalities, then you must add burn() to the clone.

// SPDX-License-Identifier: MIT

pragma solidity 0.6.12;

import "@openzeppelin/contracts/token/ERC721/extensions/ERC721URIStorage.sol";
import "@openzeppelin/contracts/access/AccessControlEnumerable.sol";

contract ERC721Example is AccessControlEnumerable, ERC721URIStorage {

    bytes32 public constant MINTER_ROLE = keccak256("MINTER_ROLE");

    constructor(
        string memory contractName,
        string memory contractSymbol
    )
        ERC721(contractName, contractSymbol)
    {
        _setRoleAdmin(MINTER_ROLE, MINTER_ROLE);
        _setupRole(MINTER_ROLE, _msgSender());
    }

    function mint(address to, uint256 tokenId)
        external
        returns (bool)
    {
        require(hasRole(MINTER_ROLE, _msgSender()), "Sender is not a Minter");
        _mint(to, tokenId);
        return true;
    }

    function burn(uint256 tokenId) public virtual {
        require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721Burnable: caller is not owner nor approved");
        _burn(tokenId);
    }
}

4. Register ERC721 in TokenManager on Origin

You need to register the origin token contract using the addERC721TokenByOwner method in the TokenManagerERC721 contract. addERC721TokenByOwner(targetSchainName, originERC721Address, targetERC721Address)

  • IMA-JS

  • Web3 JS

// import & init ima-js here

export async function linkERC721TokenOrigin(schain) {
    let erc721OnOrigin = "[ADDRESS_OF_ERC721_TOKEN_ON_ORIGIN]";
    let erc721OnTarget = "[ADDRESS_OF_ERC721_TOKEN_ON_TARGET]";

    const ZERO_ADDRESS = '0x0000000000000000000000000000000000000000';

    let address = "[YOUR_ADDRESS]";
    let privateKey = "[YOUR_PRIVATE_KEY]";

    let opts = {
        address: address,
        privateKey: privateKey // remove privateKey from txOpts to use Metamask signing
    };

    const isERC721AddedOrigin = await schain.erc721.getTokenCloneAddress(erc721OnOrigin);
    if (isERC721AddedOrigin === ZERO_ADDRESS) {
        await schain.erc721.addTokenByOwner(
            targetChainName,
            erc721OnOrigin,
            erc721OnTarget,
            opts
        );
    }
}
const Web3 = require("web3");
const Tx = require("ethereumjs-tx").Transaction;

export function registerOnOriginChain() {
  let originABIs = require("./contracts/origin_ABIs.json");
  let originERC721ABI = require("./contracts/origin_ERC721_ABI.json");
  let targetERC721ABI = require("./contracts/target_ERC721_ABI.json");

  let privateKey = Buffer.from(
    "SCHAIN_OWNER_PRIVATE_KEY",
    "hex"
  );
  
  let erc721OwnerForOrigin =
    process.env.SCHAIN_OWNER_ACCOUNT;

  let origin = process.env.ORIGIN_ENDPOINT;
  let targetChainName = process.env.TARGET_CHAIN_NAME;
  let originChainId = process.env.ORIGIN_CHAIN_ID;

  const originTokenManagerAddress = originABIs.token_manager_erc721_address;
  const originTokenManagerABI = originABIs.token_manager_erc721_abi;

  const erc721AddressOnOrigin = originERC721ABI.erc721_address;
  const erc721AddressOnTarget = targetERC721ABI.erc721_address;

  const web3ForOrigin = new Web3(origin);

  let TokenManager = new web3ForOrigin.eth.Contract(
    originTokenManagerABI,
    originTokenManagerAddress
  );

  /**
   * Uses the SKALE TokenManagerERC721
   * contract function addERC721TokenByOwner
   */
let addERC721TokenByOwner = TokenManager.methods
    .addERC721TokenByOwner(targetChainName, erc721AddressOnOrigin, erc721AddressOnTarget)
    .encodeABI();

    web3ForOrigin.eth.getTransactionCount(erc721OwnerForOrigin).then((nonce) => {
    const rawTxAddERC721TokenByOwner = {
      chainId: originChainId,
      from: erc721OwnerForOrigin,
      nonce: "0x" + nonce.toString(16),
      data: addERC721TokenByOwner,
      to: originTokenManagerAddress,
      gas: 6500000,
      gasPrice: 100000000000,
      value: web3ForOrigin.utils.toHex(
        web3ForOrigin.utils.toWei("0", "ether")
      )
    };

    //sign transaction
    const txAddERC721TokenByOwner = new Tx(rawTxAddERC721TokenByOwner, {
      chain: "rinkeby",
      hardfork: "petersburg"
    });

    txAddERC721TokenByOwner.sign(privateKey);

    const serializedTxDeposit = txAddERC721TokenByOwner.serialize();

    //send signed transaction (addERC721TokenByOwner)
    web3ForOrigin.eth
      .sendSignedTransaction("0x" + serializedTxDeposit.toString("hex"))
      .on("receipt", (receipt) => {
        console.log(receipt);
      })
      .catch(console.error);
  });

5. Register ERC721 clone in TokenManger on Target

You need to register the target token contract using the addERC721TokenByOwner method in the TokenManagerERC721 contract on the targetSchain. addERC721TokenByOwner(originSchainName, originERC721Address, targetERC721Address)

The parameters on target TokenManagerERC721.addERC721TokenByOwner() are not symmetric to origin! The only parameter to swap is the first parameter for SchainName.
  • IMA-JS

  • Web3 JS

// import & init ima-js here

export async function linkERC721TokenOrigin(schain) {
    let erc721OnOrigin = "[ADDRESS_OF_ERC721_TOKEN_ON_ORIGIN]";
    let erc721OnTarget = "[ADDRESS_OF_ERC721_TOKEN_ON_TARGET]";

    const ZERO_ADDRESS = '0x0000000000000000000000000000000000000000';

    let address = "[YOUR_ADDRESS]";
    let privateKey = "[YOUR_PRIVATE_KEY]";

    let opts = {
        address: address,
        privateKey: privateKey // remove privateKey from txOpts to use Metamask signing
    };

    const isERC721AddedTarget = await schain.erc721.getTokenCloneAddress(erc721nTarget);
    if (isERC721AddedTarget === ZERO_ADDRESS) {
        await schain.erc721.addTokenByOwner(
            originChainName,
            erc721OnOrigin,
            erc721OnTarget,
            opts
        );
    }
}
const Web3 = require("web3");
const Tx = require("ethereumjs-tx").Transaction;

export function registerOnTargetChain() {
  let targetABIs = require("./contracts/target_ABIs.json");
  let originERC721ABI = require("./contracts/origin_ERC721_ABI.json");
  let targetERC721ABI = require("./contracts/target_ERC721_ABI.json");

  let privateKey = Buffer.from(
    "SCHAIN_OWNER_PRIVATE_KEY",
    "hex"
  );
  
  let erc721OwnerForTarget =
    process.env.SCHAIN_OWNER_ACCOUNT;

  let target = process.env.TARGET_ENDPOINT;
  let originChainName = process.env.ORIGIN_CHAIN_NAME;
  let targetChainId = process.env.TARGET_CHAIN_ID;

  const targetTokenManagerAddress = targetABIs.token_manager_erc721_address;
  const targetTokenManagerABI = targetABIs.token_manager_erc721_abi;

  const erc721AddressOnOrigin = originERC721ABI.erc721_address;
  const erc721AddressOnTarget = targetERC721ABI.erc721_address;

  const web3ForTarget = new Web3(target);

  let TokenManager = new web3ForTarget.eth.Contract(
    targetTokenManagerABI,
    targetTokenManagerAddress
  );

  /**
   * Uses the SKALE TokenManagerERC721
   * contract function addERC721TokenByOwner
   */
let addERC721TokenByOwner = TokenManager.methods
    .addERC721TokenByOwner(originChainName, erc721AddressOnOrigin, erc721AddressOnTarget)
    .encodeABI();     // IMPORTANT: arguments here are not symmetric to origin addERC721TokenByOwner

    web3ForTarget.eth.getTransactionCount(erc721OwnerForTarget).then((nonce) => {
    const rawTxAddERC721TokenByOwner = {
      chainId: targetChainId,
      from: erc721OwnerForTarget,
      nonce: "0x" + nonce.toString(16),
      data: addERC721TokenByOwner,
      to: targetTokenManagerAddress,
      gas: 6500000,
      gasPrice: 100000000000,
      value: web3ForTarget.utils.toHex(
        web3ForTarget.utils.toWei("0", "ether")
      )
    };

    //sign transaction
    const txAddERC721TokenByOwner = new Tx(rawTxAddERC721TokenByOwner, {
      chain: "rinkeby",
      hardfork: "petersburg"
    });

    txAddERC721TokenByOwner.sign(privateKey);

    const serializedTxDeposit = txAddERC721TokenByOwner.serialize();

    //send signed transaction (addERC721TokenByOwner)
    web3ForTarget.eth
      .sendSignedTransaction("0x" + serializedTxDeposit.toString("hex"))
      .on("receipt", (receipt) => {
        console.log(receipt);
      })
      .catch(console.error);
  });

6. Assign MINTER and BURNER roles to TokenManager on Target.

Now you need to assign the TokenManagerERC721 contact on your SKALE Chain as the MINTER_ROLE and BURNER_ROLE for the ERC721 clone on the target. With OpenZeppelin’s framework, you simply need to execute an AddMinter, AddBurner, and/or grantRole transaction on the SKALE chain token contract.

Example Add Minter Role

  • Web3 JS

import Common from "ethereumjs-common";
const Tx = require("ethereumjs-tx").Transaction;
const Web3 = require("web3");

let schainABIs = "[YOUR_SKALE_CHAIN_ABIs]";
let schainERC721ABI = "[YOUR_SCHAIN_ERC721_ABI]";
let chainId = "[YOUR_SKALE_CHAIN_CHAIN_ID]";

const customCommon = Common.forCustomChain(
    "mainnet",
    {
      name: "skale-network",
      chainId: chainId
    },
    "istanbul"
  );

let contractOwnerPrivateKey = new Buffer("[YOUR_PRIVATE_KEY]", 'hex');

let contractOwnerAccount = "[CONTRACT_OWNER_ACCOUNT]"; // SKALE Chain owner or authorized deployer account

let schainEndpoint = "[YOUR_SKALE_CHAIN_ENDPOINT]";

const erc721ABI = schainERC721ABI.erc721_abi;
const erc721Address = schainERC721ABI.erc721_address;

const tokenManagerAddress = schainABIs.token_manager_erc721_address;

const web3ForSchain = new Web3(schainEndpoint);

let schainERC721Contract = new web3ForSchain.eth.Contract(
  erc721ABI,
  erc721Address
);

let addMinter = schainERC721Contract.methods
    .addMinter(tokenManagerAddress)
    .encodeABI();

  web3ForSchain.eth.getTransactionCount(contractOwnerAccount).then((nonce) => {
    //create raw transaction
    const rawTxAddMinter = {
      from: contractOwnerAccount,
      nonce: nonce,
      data: addMinter,
      to: erc721Address,
      gasPrice: 100000000000,
      gas: 8000000
    };
    //sign transaction
    const txAddMinter = new Tx(rawTxAddMinter, { common: customCommon });
    txAddMinter.sign(contractOwnerPrivateKey);

    const serializedTxAddMinter = txAddMinter.serialize();

    //send signed transaction (add minter)
    web3ForSchain.eth
      .sendSignedTransaction("0x" + serializedTxAddMinter.toString("hex"))
      .on("receipt", (receipt) => {
        console.log(receipt);
      })
      .catch(console.error);
  });

Get Started with S2S ERC721 Transfer

Be sure to follow any one-time setup and mapping steps described here before initiating S2S transfers.

1. S2S Transfer ERC721 From Origin

To send ERC721 tokens from a user’s wallet to another SKALE Chain, you will need to use the transferToSchainERC721 function within the TokenManagerERC721 IMA contract on the origin chain.

This method is called from the origin chain to move ERC721 tokens to a target chain.

The TokenManagerERC721 contract is predeployed on each SKALE Chain. To get the SKALE Chain ABIs, check out the current release page.

  • IMA-JS

  • Web3 JS

export function initTestTokenContractSchain(schain) {
    // initialize ERC721 contract
    const abiData = require("[ERC721_ABI_ON_ORIGIN_CHAIN]");
    return new schain.web3.eth.Contract(
        abiData.erc721_abi,
        abiData.erc721_address);
}


export async function transfer() {
    const schain = new SChain(sChainWeb3, sChainAbi); // origin schain

    let tokenName = "[TOKEN_NAME]";
    let schainERC721 = initTestTokenContractSchain(imaschain);

    let address = "YOUR_ADDRESS";
    let privateKey = "YOUR_PRIVATE_KEY";

    let tokenId = "[TOKEN_ID]";

    let opts = {
        address: address,
        privateKey: privateKey // remove privateKey from txOpts to use Metamask signing
    };

    schain.erc721.addToken(tokenName, schainERC721);

    await schain.erc721.approve(tokenName, amount, opts);
    await schain.erc721.transferToSchain(
        targetSchainName,
        schainERC721.address,
        tokenId,
        opts
    );
}
const Web3 = require("web3");
const Tx = require("ethereumjs-tx").Transaction;

let originABIs = "IMA_ABI_ON_ORIGIN";
let originERC721ABI = "ERC721_ABI_ON_ORIGIN";

let privateKey = Buffer.from("END_USER_PRIVATE_KEY", 'hex')
let address = "ADDRESS";

let origin = "ORIGIN_ENDPOINT";
let targetChainName = "TARGET_CHAIN_NAME";
let originChainId = "ORIGIN_CHAIN_ID";

const tokenManagerAddress = originABIs.token_manager_erc721_address;
const tokenManagerABI = originABIs.token_manager_erc721_abi;

const erc721ABI = originERC721ABI.erc721_abi;
const erc721Address = originERC721ABI.erc721_address;
const tokenId = "TOKEN_ID";

const web3ForOrigin = new Web3(origin);

let tokenManager = new web3ForOrigin.eth.Contract(
    tokenManagerABI,
    tokenManagerAddress
);

const customCommon = Common.forCustomChain(
    "mainnet", {
        name: "skale-network",
        chainId: originChainId
    },
    "istanbul"
);

let contractERC721 = new web3ForOrigin.eth.Contract(erc721ABI, erc721Address);

let approve = contractERC721.methods
    .approve(
        tokenManagerAddress,
        tokenId
    )
    .encodeABI();

let transfer = tokenManager.methods
    .transferToSchainERC721(
        targetChainName,
        erc721Address,
        tokenId
    )
    .encodeABI();

web3ForOrigin.eth.getTransactionCount(address).then(nonce => {
    //create raw transaction
    const rawTxApprove = {
        chainId: originChainId,
        from: address,
        nonce: "0x" + nonce.toString(16),
        data: approve,
        to: erc721Address,
        gas: 6500000,
        gasPrice: 100000000000
    };

    //sign transaction
    const txApprove = new Tx(rawTxApprove, {
        common: customCommon
    });
    txApprove.sign(privateKey);

    const serializedTxApprove = txApprove.serialize();

    //send signed transaction (approve)
    web3ForOrigin.eth
        .sendSignedTransaction("0x" + serializedTxApprove.toString("hex"))
        .on("receipt", receipt => {
            console.log(receipt);
            web3ForOrigin.eth
                .getTransactionCount(address)
                .then(nonce => {
                    const rawTxDeposit = {
                        chainId: originChainId,
                        from: address,
                        nonce: "0x" + nonce.toString(16),
                        data: transfer,
                        to: tokenManagerAddress,
                        gas: 6500000,
                        gasPrice: 100000000000
                    };

                    //sign transaction
                    const txDeposit = new Tx(rawTxDeposit, {
                        common: customCommon
                    });

                    txDeposit.sign(privateKey);

                    const serializedTxDeposit = txDeposit.serialize();

                    //send signed transaction (deposit)
                    web3ForOrigin.eth
                        .sendSignedTransaction("0x" + serializedTxDeposit
                            .toString("hex"))
                        .on("receipt", receipt => {
                            console.log(receipt);
                        })
                        .catch(console.error);
                });
        })
        .catch(console.error);
});

2. Exit from SKALE Chain

To exit ERC721 tokens back to the origin chain, you will need to use the transferToSchainERC721 function within the TokenManagerERC721 IMA contract on the target chain, and specify the erc721Address on the origin chain.

The TokenManagerERC721 IMA contract is pre-deployed to your SKALE Chain. Please reach out to your account manager to receive the ABIs specific for your SKALE Chain.

  • IMA-JS

  • Web3 JS

export function initTestTokenContractSchain(schain) {
    // initialize ERC721 contract
    const abiData = require("[ERC721_ABI_ON_TARGET_CHAIN]");
    return new schain.web3.eth.Contract(
        abiData.erc721_abi,
        abiData.erc721_address);
}


export async function transfer() {
    const schain = new SChain(sChainWeb3, sChainAbi); // target schain

    let tokenName = "[TOKEN_NAME]";
    let schainERC721 = initTestTokenContractSchain(schain);

    let address = "YOUR_ADDRESS";
    let privateKey = "YOUR_PRIVATE_KEY";

    let tokenAddressOriginChain = "[TOKEN_ADDRESS]";

    let tokenId = "[TOKEN_ID]";

    let opts = {
        address: address,
        privateKey: privateKey // remove privateKey from txOpts to use Metamask signing
    };

    schain.erc721.addToken(tokenName, schainERC721);

    await schain.erc721.approve(tokenName, amount, opts);
    await schain.erc721.transferToSchain(
        targetSchainName,
        tokenAddressOriginChain, // KEY DIFFERENCE - you should set address of the token on the origin chain
        tokenId,
        opts
    );
}
const Web3 = require("web3");
const Tx = require("ethereumjs-tx").Transaction;

let targetABIs = "IMA_ABI_ON_TARGET";
let originERC721ABI = "ERC721_ABI_ON_ORIGIN";

let privateKey = Buffer.from("END_USER_PRIVATE_KEY", 'hex')
let address = "ADDRESS";

let target = "TARGET_ENDPOINT";
let originChainName = "ORIGIN_CHAIN_NAME";
let targetChainId = "TARGET_CHAIN_ID";

const tokenManagerAddress = targetABIs.token_manager_erc721_address;
const tokenManagerABI = targetABIs.token_manager_erc721_abi;

const erc721ABI = targetERC721ABI.erc721_abi;
const erc721TargetAddress = targetERC721ABI.erc721_address;
const erc721OriginAddress = originERC721ABI.erc721_address;
const tokenId = "TOKEN_ID";

const web3ForTarget = new Web3(target);

let tokenManager = new web3ForTarget.eth.Contract(
    tokenManagerABI,
    tokenManagerAddress
);

const customCommon = Common.forCustomChain(
    "mainnet", {
        name: "skale-network",
        chainId: targetChainId
    },
    "istanbul"
);

let contractERC721 = new web3ForTarget.eth.Contract(erc721ABI, erc721TargetAddress);

let approve = contractERC721.methods
    .approve(
        tokenManagerAddress,
        tokenId
    )
    .encodeABI();

let transfer = tokenManager.methods
    .transferToSchainERC721(
        originChainName,
        erc721OriginAddress,
        tokenId
    )
    .encodeABI();

    web3ForTarget.eth.getTransactionCount(address).then(nonce => {
    //create raw transaction
    const rawTxApprove = {
        chainId: targetChainId,
        from: address,
        nonce: "0x" + nonce.toString(16),
        data: approve,
        to: erc721Address,
        gas: 6500000,
        gasPrice: 100000000000
    };

    //sign transaction
    const txApprove = new Tx(rawTxApprove, {
        common: customCommon
    });
    txApprove.sign(privateKey);

    const serializedTxApprove = txApprove.serialize();

    //send signed transaction (approve)
    web3ForTarget.eth
        .sendSignedTransaction("0x" + serializedTxApprove.toString("hex"))
        .on("receipt", receipt => {
            console.log(receipt);
            web3ForTarget.eth
                .getTransactionCount(address)
                .then(nonce => {
                    const rawTxDeposit = {
                        chainId: targetChainId,
                        from: address,
                        nonce: "0x" + nonce.toString(16),
                        data: transfer,
                        to: tokenManagerAddress,
                        gas: 6500000,
                        gasPrice: 100000000000
                    };

                    //sign transaction
                    const txDeposit = new Tx(rawTxDeposit, {
                        common: customCommon
                    });

                    txDeposit.sign(privateKey);

                    const serializedTxDeposit = txDeposit.serialize();

                    //send signed transaction (deposit)
                    web3ForTarget.eth
                        .sendSignedTransaction("0x" + serializedTxDeposit
                            .toString("hex"))
                        .on("receipt", receipt => {
                            console.log(receipt);
                        })
                        .catch(console.error);
                });
        })
        .catch(console.error);
});