Polygon智能合约可以称呼以太坊智能合约功能吗?

发布于 2025-01-31 01:41:40 字数 622 浏览 1 评论 0原文

pragma solidity ^0.8.0;
interface AnotherContract {
    function walletOfOwner(address owner) external view returns (uint256[] memory);
}

contract Test{
    uint public similarity;
    uint256 public hasRedPill;
    function test() public view returns(uint256  ){
       AnotherContract anotherContract = AnotherContract(address(0x116486FD64Ba04F7B789278B239E2e5A1e2f7b39));
      return anotherContract.walletOfOwner(msg.sender).length;
    }


}

我在这里使用的合同地址已经部署在以太坊区块链上。

我想在多边形上部署测试合同。但是看来它无法调用WalletoFowner()函数。但是,如果两个合同都部署在同一网络上,则可以正常工作。因此,有什么方法可以在这些合同之间建立链间连接。

我是新的。请帮忙。

pragma solidity ^0.8.0;
interface AnotherContract {
    function walletOfOwner(address owner) external view returns (uint256[] memory);
}

contract Test{
    uint public similarity;
    uint256 public hasRedPill;
    function test() public view returns(uint256  ){
       AnotherContract anotherContract = AnotherContract(address(0x116486FD64Ba04F7B789278B239E2e5A1e2f7b39));
      return anotherContract.walletOfOwner(msg.sender).length;
    }


}

The contract address I have used here already deployed on Ethereum blockchain.

I want to deploy the Test Contract on Polygon. But It seems it can not call the walletOfOwner() function. But it works fine if both the contract is deployed on same network. So, is there any way I can establish an inter-chain connection between these contracts.

I am very new to this. Please help.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

青巷忧颜 2025-02-07 01:41:40

所以,我有什么办法可以在这些合同之间建立链间连接。

不,实际上是不可能的。

So, is there any way I can establish an inter-chain connection between these contracts.

No, in practice, not possible.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文