我有一份合同,看起来像这样 -
contract Calculator {
uint public result;
constructor() public {
result = 777; //note the initial value
}
function add(uint a, uint b) public returns (uint, address) {
result = a + b;
return (result, msg.sender);
}
}
当我在松露上调用该函数时,我得到了正确的交易 -
truffle(development)> await calculator.add(5,11)
{
tx: '0xa66e94bb28810bb2a861c97ee149718afa599d47b7b1c6e55743ea657fdeef56',
receipt: {
transactionHash: '0xa66e94bb28810bb2a861c97ee149718afa599d47b7b1c6e55743ea657fdeef56',
transactionIndex: 0,
blockHash: '0x6ae4e3ce65f1e177c419306a50662ed46f40c729a6a18ede028b07e63dd12f61',
blockNumber: 6,
from: '0x5d88950b52f89ad66906fc263e8c35ddacff04d4',
to: '0x7c8beb382c70cbf12b41fd4e5d74cfee53fdc391',
gasUsed: 26074,
cumulativeGasUsed: 26074,
contractAddress: null,
logs: [ [Object] ],
status: true,
logsBloom: '0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000000000000000200000000000000000000000000000000000000',
rawLogs: [ [Object] ]
},
logs: [
{
logIndex: 0,
transactionIndex: 0,
transactionHash: '0xa66e94bb28810bb2a861c97ee149718afa599d47b7b1c6e55743ea657fdeef56',
blockHash: '0x6ae4e3ce65f1e177c419306a50662ed46f40c729a6a18ede028b07e63dd12f61',
blockNumber: 6,
address: '0x7C8beb382C70CbF12b41fd4e5d74CfEe53FDc391',
type: 'mined',
id: 'log_28a5e84f',
event: 'Added',
args: [Result]
}
]
}
月关宝盒
相关分类