I'm trying to deploy my library and call it afterwards with the specific address. While testing this I encountered that the behavior changed over the course of compilers.
I tried to follow How to call a library contract but the following inconsistency happened:
Library 1
pragma solidity 0.7.0;
library Seven {
function seven() public returns (bool) {
return true;
}
}
Library 2
pragma solidity 0.4.6;
library Foursix {
function foursix() public returns (bool) {
return true;
}
}
Main Contract
pragma solidity 0.7.0;
abstract contract Foursix {
function foursix() virtual public returns (bool);
}
abstract contract Seven {
function seven() virtual public returns (bool);
}
contract Foo {
function callfoursix(address a) public {
Foursix fs = Foursix(a);
bool b = fs.foursix();
}
function callseven(address a) public {
Seven s = Seven(a);
bool b = s.seven();
}
}
notice how Library 1 and 2 are identical besides the used compiler. When testing in remix Library 1 gets the error:
transact to Foo.callseven errored: VM error: revert.
while the call to Library 2 succeeds.
Why is this the case and how do I call the Library 1 contract? It does seem that ABI encoding has something to do with it as the newer version is seemingly not found but for the moment I'm clueless.