You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
contractProxyForward {
mapping (bytes4=>address) facets;
function setFacet(bytes4signature_, addressfacet_) public {
facets[signature_] = facet_;
}
fallback() external {
address facet = facets[msg.sig];
// Execute external function from facet using delegatecall and return any value.assembly {
// copy function selector and any argumentscalldatacopy(0, 0, calldatasize())
// execute function call using the facetlet result :=delegatecall(gas(), facet, 0, calldatasize(), 0, 0)
// get any return valuereturndatacopy(0, 0, returndatasize())
// return any return value or error back to the callerswitch result
case0 {revert(0, returndatasize())}
default {return (0, returndatasize())}
}
}
}
Context
Provide a way to allow for arbitrary execution. The execution can be delegated to an external contract with a predefined interface.
Details
The methods can be defined as:
IMockProviderExec
can be defined as:Alternatives
A contract could inherit the
MockProvider
and add the methods is requires with the code it could specify as the implementation forIMockProviderExec
.Has the feature been requested before?
No and not sure if it's useful.
The text was updated successfully, but these errors were encountered: