The below code fails when calling foo() on TestContract. The adaptedLib as been set to the right address. How do you make a delegatecall to a lib correctly?
contract TestContract {
address public adapterLib;
uint public a;
function setLib(address lib)public{
adapterLib = lib;
}
function foo()public {
(bool success, bytes memory returnData) = adapterLib.delegatecall(
abi.encodeWithSignature('foo(uint)', 1)
);
}
}
library Test{
function foo(State storage state)external returns(uint){
return 1;
}
}