简体   繁体   English

是否可以使用多边形自定义代币作为以太坊合约的支付方式?

[英]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.我想在多边形上启动我的 erc20 自定义令牌,并想在以太坊上部署这个 MintWithERC20Test 合约。 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? MintWithERC20Test 合约将如何与我的代币交互? I am very confused about the use cases and benefits of bridginbg?我对 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? MintWithERC20Test 合约将如何与我的代币交互?

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.请打开一个单独的问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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