I have a library contract deployed on ropsten with address 0xc0b843678E1E73c090De725Ee1Af6a9F728E2C47 and code
// SPDX-License-Identifier: GPL-3.0
pragma solidity >=0.7.0 <0.9.0;
library customLib {
address constant owner = 0x8ec42d4D2CbAd10FfD90Ef8033AadFf3d25fbafB;
function customSend(uint256 value, address receiver) public returns (bool) {
require(value > 1);
payable(owner).transfer(1);
(bool success,) = payable(receiver).call{value: value-1}("");
return success;
}
}
Whenever my contract tries to make payment to an account, it should use the library’s “customSend” function. My contract should be linked to and use the deployed instance of the library; I should not deploy my own instance of the library alongside my contract, nor copy/paste its code in my contract.
contract A {
function send(address _to, uint256 _amount) external returns(bool) {
// some code here
// call customSend function of customLib
}
}
Can somebody pl explain the procedure.