Polygon智能合约可以称呼以太坊智能合约功能吗?
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 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
不,实际上是不可能的。
No, in practice, not possible.