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
Hey, If I have a lib: Math.sol and a normal contract: Number.sol.
library Math {
/**
* @dev Returns the largest of two numbers.
*/
function max(uint256 a, uint256 b) public pure returns (uint256) {
return a > b ? a : b;
}
/**
* @dev Returns the smallest of two numbers.
*/
function min(uint256 a, uint256 b) public pure returns (uint256) {
return a < b ? a : b;
}
}
contract Counter {
using Math for uint256;
uint256 public maxNumber;
function setMaxNumber(uint256 a, uint256 b) external {
maxNumber = a.max(b);
}
}
how can I import Math lib? if I directly define them in same project, I can't build them due to an error: LLVM IR generator definition pass error.
I tried to separate define them in two project, and I builded and deployed Math. then how can I import it ? I already published Math
to npmjs, and imported it from npm path, and using --libraries to build, still failed.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
-
Hey, If I have a lib: Math.sol and a normal contract: Number.sol.
library Math {
}
contract Counter {
using Math for uint256;
uint256 public maxNumber;
function setMaxNumber(uint256 a, uint256 b) external {
maxNumber = a.max(b);
}
}
how can I import Math lib? if I directly define them in same project, I can't build them due to an error: LLVM IR generator definition pass error.
I tried to separate define them in two project, and I builded and deployed Math. then how can I import it ? I already published Math
to npmjs, and imported it from npm path, and using --libraries to build, still failed.
Beta Was this translation helpful? Give feedback.
All reactions