报错信息:VM error: revert.
解决方法:可以尝试一下不带value创建值;合约创建完成之后再给予value;再调用带有payable的付费函数,就成功了
//SPDX-License-Identifier:MIT
pragma solidity ^0.8.17;
contract url {
function info() public payable returns(uint ret){
return msg.value;
}
function getbalance () public view returns(uint){
return address(this).balance;
}
}
contract customer{
address owner;
constructor(){
owner = msg.sender;
}
function pay() public payable returns(uint){
return msg.value;
}
function addBool () public view returns(bool a){
if(owner == msg.sender){
return true;
}
}
function getbalance () public view returns(uint){
return address(this).balance;
}
function useinfo (address _addr) public returns (uint){
url feed = url(_addr);
return feed.info{value: 10 ether,gas:800}();
}
}