sai*_*tam 4 arguments ethereum solidity remix
如何在 Remix 中传递多个参数?无论我以哪种方式将参数传递给setOrder函数,都会收到不同的错误:
语法错误:JSON 中的意外标记位于位置 1
错误:无效的 bytes32 值(arg=undefined,type="string",value="abc")
这是代码:
pragma solidity ^0.4.11;
contract MyContract {
bytes32 public customer;
bytes32 public location;
bytes32 public product;
bytes32 public reorderAmount;
bytes32 public usdLitrePrice;
bytes32 public usdTotalPrice;
bytes32 public timestamp;
function setOrder(bytes32 _customer, bytes32 _location, bytes32 _product, bytes32 _reorderAmount,
bytes32 _usdLitrePrice, bytes32 _usdTotalPrice, bytes32 _timestamp) public {
customer = _customer;
location = _location;
product = _product;
reorderAmount = _reorderAmount;
usdLitrePrice = _usdLitrePrice;
usdTotalPrice = _usdTotalPrice;
timestamp = _timestamp;
}
function getOrder() public constant returns (bytes32, bytes32, bytes32, bytes32, bytes32, bytes32, bytes32) {
return (customer, location, product, reorderAmount, usdLitrePrice, usdTotalPrice, timestamp);
}
}
Run Code Online (Sandbox Code Playgroud)
这是解决方案:
逗号后不能有空格,
您不能使用'--> 而是使用"
你必须使用十六进制 0x...
例子:
"0x123","0x123","0x123","0x123","0x123","0x123","0x123"
| 归档时间: |
|
| 查看次数: |
5544 次 |
| 最近记录: |