Hello! I want to call a function from an outer contract but I wonder why is my .call failing. The function looks like this:
// Starts a Process on another contract specific object
function _startProcess(
uint32 activeFrom,
uint32 activeUntil,
uint256 _id
) external {
ERC1967Proxy contractProxyToStart = getContractProxyById(_id);
(bool success, ) = address(contractProxyToStart).call(
abi.encodeWithSelector(Implementation(address(contractProxyToStart)).startProcess.selector,
activeFrom,
activeUntil
)
);
require(success, "FAILED");
emit PreSaleCreated(address(eventProxyToStart));
}
And it is calling the following in the implementation contract:
function startProcess(uint32 _activeFrom, uint32 _activeUntil)
external
onlyRole(MANAGER_ROLE)
{
(
uint256[] memory eventIndexes,
EventLibrary.IndexedEvent[] memory events
) = getUpdatedEvents();
EventLibrary.EventState currentState;
for (uint256 i = 0; i < eventIndexes.length; i++) {
if (
idToEvent[eventIndexes[i]].eventState !=
EventLibrary.EventState.deactivated
) {
revert("All events must be deactivated to start a pre-sale");
}
if (_activeFrom | _activeUntil >= idToEvent[eventIndexes[i]].startDate) {
revert(
"Process must start and end before the event/series of events start date"
);
}
idToEvent[eventIndexes[i]].eventState =
EventLibrary.EventState.onPreSale;
contractToSaleTrack[address(this)].eventContract = address(this);
currentState = idToEvent[eventIndexes[i]].eventState;
}
emit EventLibrary.EventSeriesStateChange(
address(this),
currentState,
events
);
}
Does the .call method relays reverts triggered by the conditionals without notifying it on the outer contract? How would you debug this?
pd. If I call it with ".delegatecall" it doesn't fail and fires the events well so I guess the error is coming from the inner contract?