We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
在solidity合约中定义出错信息: only authorized owner can store files. EVM交易中打印的信息中会多出一些空格符号,有时间可以优化下:
receipt": { "ty": 1, "tyName": "ExecPack", "logs": [ { "ty": 1, "tyName": "LogErr", "log": "evm: execution reverted,detail: \u0008\ufffdy\ufffd\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000 \u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0026only authorized owner can store files.\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000", "rawLog": "0x65766d3a20657865637574696f6e2072657665727465642c64657461696c3a2008c379a0000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000266f6e6c7920617574686f72697a6564206f776e65722063616e2073746f72652066696c65732e0000000000000000000000000000000000000000000000000000" } ] },
solidity合约参考代码如下: ==== BasicAuth.sol contract BasicAuth { address public _owner;
constructor() public { _owner = msg.sender; } function setOwner(address owner) public onlyOwner { _owner = owner; } modifier onlyOwner() { require(msg.sender == _owner, "only authorized owner can store files."); _; }
}
===== FileStore.sol pragma solidity >=0.6.2 <0.7.0;
import "./BasicAuth.sol";
contract FileStore is BasicAuth { mapping(string => string) _fileStockByID;
modifier validFileId(string memory fileId) { require(bytes(fileId).length > 0, "fileId is invalid!"); _; } function setFileStockById(string memory fileId, string memory content) onlyOwner validFileId(fileId) external { _fileStockByID[fileId] = content; } function getFileById(string memory fileId) external view returns(string memory) { return _fileStockByID[fileId]; }
The text was updated successfully, but these errors were encountered:
No branches or pull requests
在solidity合约中定义出错信息: only authorized owner can store files.
EVM交易中打印的信息中会多出一些空格符号,有时间可以优化下:
receipt": {
"ty": 1,
"tyName": "ExecPack",
"logs": [
{
"ty": 1,
"tyName": "LogErr",
"log": "evm: execution reverted,detail: \u0008\ufffdy\ufffd\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000 \u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0026only authorized owner can store files.\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000",
"rawLog": "0x65766d3a20657865637574696f6e2072657665727465642c64657461696c3a2008c379a0000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000266f6e6c7920617574686f72697a6564206f776e65722063616e2073746f72652066696c65732e0000000000000000000000000000000000000000000000000000"
}
]
},
solidity合约参考代码如下:
==== BasicAuth.sol
contract BasicAuth {
address public _owner;
}
===== FileStore.sol
pragma solidity >=0.6.2 <0.7.0;
import "./BasicAuth.sol";
contract FileStore is BasicAuth {
mapping(string => string) _fileStockByID;
}
The text was updated successfully, but these errors were encountered: