When a checkLog(...)
function is triggered on upkeep contract, what will be avaialable in the log.data
parameter of the log
. For example in this case:
function checkLog(Log calldata log, bytes memory)
external
override
returns (bool upkeepNeeded, bytes memory performData)
{
address logSender = bytes32ToAddress(log.topics[0]);
uint256 number = bytes32ToUint(log.topics[1]);
performData = abi.encode(logSender, number, log.txHash, log.timestamp, log.data);
return (true, performData);
}
function performUpkeep(bytes calldata performData) external override {
(address logSender, uint256 number, bytes32 txnHash, uint256 timestamp, bytes memory data) = abi.decode(
performData,
(address, uint256, bytes32, uint256, bytes)
);
counter += 1;
logDataRetrieved = data;
emit Bumped(logSender, msg.sender, number, block.number, counter, txnHash, timestamp, data);
}
we are sending this log.data
to the performUpkeep(...)
function in encoded form. But when we log this data, in Bumped
event, we are not getting anything. Even we stored the data
retrieved in logDataRetrieved
. But that is also empty.
Upon asking the question on developer channel in discord, I got reply that it contains the data of the log emitted in encoded form. But this is not the case, as the contract that emitted the log contains two arguments, msg.sender
and a number
.
emit Bump(msg.sender, number);
I need to know what is actually stored in this. And also is it affected by some parameter mentioned on the automation UI?
I have tried both logging the value through event and storing it in the storage. But I got nothing.
6056 Aamir Usmani is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.