function calculate(
uint index
)public view returns(uint, uint, bool){
uint avh1;
uint avh2;
uint avh3;
uint avl1;
uint avl2;
uint avl3;
uint allowbuy;
uint allowsell;
//function add(uint256 a, uint256 b) internal pure returns (uint256) {
// return a + b;
priceHistory memory coinToReturn = stableCoins[index];
avh1 = coinToReturn.highestPricethismonth.add (coinToReturn.highestPrice2MonthsAgo);
avh2 = coinToReturn.highestPrice3MonthsAgo.add (coinToReturn.highestPrice4MonthsAgo);
avh3 = avh1.add (avh2); avh3/4= allowsell;
avl1 = coinToReturn.lowestPricethismonth.add (coinToReturn.lowestPrice2MonthsAgo);
avl2 = coinToReturn.lowestPrice3MonthsAgo.add (coinToReturn.lowestPrice4MonthsAgo);
avl3 = avl1.add (avl2); avl3.div (4) = allowbuy;
return (allowbuy);
return (allowsell);
return (success);
}在我最后被分割的行中,无论我使用什么方法来划分,我都会得到同样的错误消息,“表达式必须是一个1值”。
发布于 2021-10-11 16:39:07
这些都是无效的稳固代码。
avh3/4= allowsell;
...
avl3.div (4) = allowbuy;若要将结果分配给变量,您必须左、右交换。
allowsell = avh3/4;
...
allowbuy = avl3.div(4);https://ethereum.stackexchange.com/questions/111353
复制相似问题