Skip to content

Commit 5252876

Browse files
authored
Include setup & example of importing TPL contracts
1 parent ccf4bf4 commit 5252876

1 file changed

Lines changed: 28 additions & 1 deletion

File tree

README.md

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,34 @@ TPL is designed to be flexible enough for a wide variety of use-cases beyond jus
3737

3838

3939
## Install
40-
First, ensure that [Node.js](https://nodejs.org/en/download/current/), [Yarn](https://yarnpkg.com/en/docs/install), and [ganache-cli](https://github.com/trufflesuite/ganache-cli#installation) are installed. Next, clone the repository and install dependencies:
40+
### Install via NPM to import contracts
41+
To create a new project with TPL contracts as a dependency:
42+
43+
```sh
44+
$ yarn global add truffle@5.0.0-beta.1 # or $ npm install -g truffle@5.0.0-beta.1
45+
$ truffle init && yarn init # or npm init
46+
$ yarn add openzeppelin-solidity # or npm install openzeppelin-solidity
47+
$ yarn add tpl-contracts # or $ npm install tpl-contracts
48+
```
49+
50+
Then, import it in your contracts like so:
51+
```solidity
52+
pragma solidity ^0.4.25;
53+
54+
import "tpl-contracts/contracts/BasicJurisdiction.sol";
55+
56+
57+
contract Test is BasicJurisdiction {
58+
string public name;
59+
60+
constructor() public {
61+
name = "My First Jurisdiction";
62+
}
63+
}
64+
```
65+
66+
### Install directly to run tests or develop
67+
To install directly, first ensure that [Node.js](https://nodejs.org/en/download/current/), [Yarn](https://yarnpkg.com/en/docs/install), and [ganache-cli](https://github.com/trufflesuite/ganache-cli#installation) are installed. Next, clone the repository and install dependencies:
4168

4269
```sh
4370
$ git clone https://github.com/TPL-protocol/tpl-contracts

0 commit comments

Comments
 (0)