pragma solidity ^0.4.7 ;
contract MyContract
{
string sentence = "my first sentence" ;
address owner ;
function MyContract()
{
owner = msg.sender ;
}
function getSentence() public constant returns(string) {
return sentence ;
}
function setSentence(string newsentence) public returns (string)
{
if(owner!= msg.sender)
{
return "don't dare to change the contract" ;
}
sentence = newsentence ;
return sentence ;
}
uint balance=100 ;
uint value ;
function Transact(uint value) public returns(uint)
{
assert(value % 10 == 0) ;
require(value<= balance) ;
balance = balance - value ;
return balance ;
}
}
发布于 2019-03-03 18:39:44
@Rishabh,
这是一个您正在使用的坚固版本的问题。这个(断言,要求)关键字不是0.4.7版本的一部分。
我刚刚将其升级为务实性^0.4.24;它运行得很好。
请找到可靠的文档以供参考:http://solidity.readthedocs.io/en/latest/control-structures.html#exceptions
https://ethereum.stackexchange.com/questions/67871
复制相似问题