How connect library to smart contract from external resources?

Viewed 1878
pragma solidity ^0.4.15;

import './ERC20.sol';
import './SafeMath.sol';

How connect SafeMath.sol from external(non-local) resourses?

2 Answers

This is probably what you mean:

pragma solidity ^0.4.0;

import "github.com/OpenZeppelin/zeppelin-solidity/contracts/math/SafeMath.sol";

contract MathExtended {
    using SafeMath for uint;
    function exec(uint a, uint b) returns (uint){
        return a.add(b);
    }
}

Solidity supports importing from Github directly, just remember not to include commits or branches when reference it must be the user/project/file-path/file.sol directly.

See http://solidity.readthedocs.io/en/develop/layout-of-source-files.html

Related