1

I successfully deployed a contract with remix here on Ropsten Testnet: https://ropsten.etherscan.io/address/0x10273a926517b417015748da21e1287bab2da8f7

The Source Code is very simple but I'm using my own SafeMath library:

    pragma solidity ^0.4.24;

    library SafeMath {
      function mul(uint256 a, uint256 b) internal pure returns (uint256 c) {
        if (a == 0) {
          return 0;
        }
        c = a * b;
        assert(c / a == b);
        return c;
      }
    }

    contract ExampleSend {
        using SafeMath for uint256;
        function sendEther(uint256 amount, address[] targets) public returns (bool){
            uint256 countTargets = targets.length;

            require( address(this).balance > amount.mul(countTargets));

            for(uint256 i = 0; i < countTargets; i++){
                targets[i].transfer(amount);
            }
        }
    }

When I wanted to verify my code on etherscan, it asked my to put my libraries and the corresponding address. But I can't find where my library was deployed to on my console nor in my account history. I've tried leaving the library options blank and putting my own contract address in the filed but neither of them worked.

  • When I provided contract library address with the address of the contract, I got the following error message: Error! The Library Name (SafeMath) and Address (10273a926517b417015748da21e1287bab2da8f7) was provided but not used in the contract)

Can someone tell me how to get my library address?

  • It turned out that there's something wrong with my Chrome Browser encoding or something. I used the same code and deployed it through remix on Firefox then everything works perfectly. – Anton Cheng Aug 17 '18 at 3:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.