今日はSolidity開発時におけるTipsとして、Remixで開発しているときにOpenZepplinを呼び出す方法を解説していきます。
import時にURLで直接指定をする
Solidityではimport時にgithub.comから始まるURLを直接指定することが可能です。
例)Ownableを呼び出して使用する
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pragma solidity ^0.4.24; | |
// このような形で呼び出しを行うことが可能 | |
import "github.com/OpenZeppelin/openzeppelin-solidity/contracts/ownership/Ownable.sol"; | |
contract SmartTerms is Ownable { | |
function ownerDo() public onlyOwner { | |
// owner Do! | |
} | |
} |
他のライブラリでは試していませんが、恐らく同じやり方でOpenZepplin以外のライブラリも利用できると思います。
覚えておくと開発時に便利なので、Tipsとしてぜひ頭の片隅に置いてみてください。