library in solidity
this变量
library MathLib {
function multiply(uint a, uint b) public view returns (uint, address) {
return (a * b, address(this));
}
}
contract Example {
using MathLib for uint;
address public owner = address(this);
address public retAddr;
function multiplyExample(uint _a, uint _b) public view returns (uint, address) {
uint a;
(a, retAddr) = _a.multiply(_b);
return (a, retAddr);
}
}