Suppose I have the following code:
// SPDX-License-Identifier: MIT
pragma solidity >=0.4.21 <0.7.0;
library SomeLib {
function add(uint256 a, uint256 b) public returns(uint256);
}
contract SomeContract {
function calc(uint256 a, uint256 b) public returns(uint256) {
uint256 ans = SomeLib.add(a, b);
return ans;
}
}
It works with no problem if my solc
compiler version < 0.6.0 however, it fails to compile version >= 0.6.0 returns following:
TypeError: Library functions must be implemented if declared.
Any idea or something missing here?
Here are the setup:
$ npx truffle version
Truffle v5.1.56 (core: 5.1.56)
Solidity - 0.6.12 (solc-js)
Node v12.18.3
Web3.js v1.2.9
add
is not implemented. – Ismael Dec 7 '20 at 17:44