简体   繁体   中英

Is it possible to use polygon custom token as payment on an ethereum contract?

// SPDX-License-Identifier: MIT pragma solidity ^0.8.0;

import "@openzeppelin/contracts/token/ERC20/IERC20.sol";

contract MintWithERC20Test {
    IERC20 token = IERC20(0x2de52C26AED95e4E618ec91b7F1cfb651214a4d8);
    uint256 public cost = 99000000000000000000;

    
    constructor() {
        
    }

  
    
    function depositToken(uint _amount, uint _mintAmount) public {
        require(_amount >= cost * _mintAmount);
       
        token.transferFrom(msg.sender, address(this), _amount);
        //some code mint()
    }

   
    function getSmartContractBalance() external view returns(uint) {
        return token.balanceOf(address(this));
    } }

I want to launch my erc20 custom token on polygon and want to deploy this MintWithERC20Test contract on ethereum. Now as far as I know I cannot use the polygon token address on ethereum contract. So, is there any other way to use my polygon token as payment on ethereum contract? If I send some of my custom tokens from polygon to ethereum through bridging, will the above given code work? How will MintWithERC20Test contract then interact with my token? I am very confused about the use cases and benefits of bridginbg?

Another possible way I can think of listing my token on a market place. But to my knowledge, that will enable me to use my token as payment on polygon contracts only.

Please help. I am a new blockchain kid.

So, is there any other way to use my polygon token as payment on ethereum contract?

No

If I send some of my custom tokens from polygon to ethereum through bridging, will the above given code work?

No

How will MintWithERC20Test contract then interact with my token?

Please open a separate question if you do not know how to interact with deployed contracts.

I am very confused about the use cases and benefits of bridging?

Please open a separate question.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM