Skip to content
This repository was archived by the owner on Dec 7, 2023. It is now read-only.

Commit 3071217

Browse files
authored
Merge pull request #96 from beehive-innovation/2021-09-10-npm-package
npm package & remove submodule dependency
2 parents 33fa9b9 + 7d9cfa9 commit 3071217

23 files changed

+775
-506
lines changed

.github/workflows/deploy-docs.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ jobs:
1515
uses: actions/checkout@v2
1616
with:
1717
ref: develop
18-
submodules: "recursive"
1918

2019
- name: Install nix
2120
uses: cachix/install-nix-action@v13

.github/workflows/publish-npm.yaml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
name: Publish npm package
2+
3+
on:
4+
create:
5+
tags: ["v[0-9]+.[0-9]+.[0-9]+*"]
6+
7+
jobs:
8+
publish:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- env:
12+
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
13+
14+
- name: Checkout
15+
uses: actions/checkout@v2
16+
with:
17+
token: ${{ secrets.ACCESS_TOKEN }}
18+
19+
- name: Install nix
20+
uses: cachix/install-nix-action@v13
21+
with:
22+
nix_path: nixpkgs=channel:nixos-unstable
23+
24+
- name: Prepack for npm
25+
run: nix-shell --run prepack
26+
27+
- name: Publish to npm
28+
run: nix-shell --run publish

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,5 @@ bin
1111
!dist/**/artifacts
1212
docs/api
1313
bin
14+
*.tgz
15+
.npmrc

.gitmodules

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +0,0 @@
1-
[submodule "contracts/configurable-rights-pool"]
2-
path = contracts/configurable-rights-pool
3-
url = git@github.com:balancer-labs/configurable-rights-pool.git

README.md

Lines changed: 30 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,20 +2,44 @@
22

33
Rain Protocol supports fair value capture for intangible or physical assets in a permissionless way in any decentralised environment.
44

5-
Documentation can be found [here](https://beehive-innovation.github.io/rain-protocol).
5+
## Installation
6+
7+
```console
8+
npm install rain-protocol
9+
```
610

7-
## Development setup (contributors)
11+
## Usage
812

9-
### Git submodules
13+
### Importing contracts
1014

11-
As we are wrapping balancer contracts, we have git submodules pointing to their repositories.
15+
```solidity
16+
pragma solidity ^0.6.12;
17+
18+
import "rain-protocol/contracts/ReadWriteTier.sol";
19+
20+
contract MyContract is ReadWriteTier {
21+
...
22+
}
23+
```
1224

13-
When you clone this repository make sure to use `--recurse-submodules`
25+
### Importing contract [artifact](https://hardhat.org/guides/compile-contracts.html#artifacts) (e.g. abi, bytecode)
1426

27+
```typescript
28+
const trustJson = require("rain-protocol/artifacts/Trust.json");
1529
```
16-
git clone --recurse-submodules git@github.com:thedavidmeister/tv-balancer.git
30+
31+
### Using with [TypeChain](https://github.com/dethcrypto/TypeChain)
32+
33+
```typescript
34+
import type { Trust } from "rain-protocol/typechain/Trust";
1735
```
1836

37+
## Documentation
38+
39+
Documentation can be found [here](https://beehive-innovation.github.io/rain-protocol).
40+
41+
## Development setup (for contributors)
42+
1943
### Nix Shell
2044

2145
Install the nix shell if you haven't already.

contracts/RedeemableERC20Pool.sol

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,23 +9,23 @@ import { Math } from "@openzeppelin/contracts/math/Math.sol";
99
import { IERC20 } from "@openzeppelin/contracts/token/ERC20/IERC20.sol";
1010
import { SafeERC20 } from "@openzeppelin/contracts/token/ERC20/SafeERC20.sol";
1111

12-
import { IBPool } from "./configurable-rights-pool/contracts/IBFactory.sol";
13-
import { BPool } from "./configurable-rights-pool/contracts/test/BPool.sol";
12+
import { IBPool } from "configurable-rights-pool/contracts/IBFactory.sol";
13+
import { BPool } from "configurable-rights-pool/contracts/test/BPool.sol";
1414
import {
1515
RightsManager
16-
} from "./configurable-rights-pool/libraries/RightsManager.sol";
16+
} from "configurable-rights-pool/libraries/RightsManager.sol";
1717
import {
1818
BalancerConstants
19-
} from "./configurable-rights-pool/libraries/BalancerConstants.sol";
19+
} from "configurable-rights-pool/libraries/BalancerConstants.sol";
2020
import {
2121
ConfigurableRightsPool
22-
} from "./configurable-rights-pool/contracts/ConfigurableRightsPool.sol";
22+
} from "configurable-rights-pool/contracts/ConfigurableRightsPool.sol";
2323
import {
2424
CRPFactory
25-
} from "./configurable-rights-pool/contracts/CRPFactory.sol";
25+
} from "configurable-rights-pool/contracts/CRPFactory.sol";
2626
import {
2727
BFactory
28-
} from "./configurable-rights-pool/contracts/test/BFactory.sol";
28+
} from "configurable-rights-pool/contracts/test/BFactory.sol";
2929

3030
import { Phase, Phased } from "./Phased.sol";
3131
import { RedeemableERC20 } from "./RedeemableERC20.sol";

contracts/RedeemableERC20PoolFactory.sol

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,10 @@ import {
1010
} from "./RedeemableERC20Pool.sol";
1111
import {
1212
CRPFactory
13-
} from "./configurable-rights-pool/contracts/CRPFactory.sol";
13+
} from "configurable-rights-pool/contracts/CRPFactory.sol";
1414
import {
1515
BFactory
16-
} from "./configurable-rights-pool/contracts/test/BFactory.sol";
16+
} from "configurable-rights-pool/contracts/test/BFactory.sol";
1717
import { IERC20 } from "@openzeppelin/contracts/token/ERC20/IERC20.sol";
1818
import { RedeemableERC20 } from "./RedeemableERC20.sol";
1919

contracts/Trust.sol

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,10 @@ import { SafeERC20 } from "@openzeppelin/contracts/token/ERC20/SafeERC20.sol";
1515

1616
import {
1717
CRPFactory
18-
} from "./configurable-rights-pool/contracts/CRPFactory.sol";
18+
} from "configurable-rights-pool/contracts/CRPFactory.sol";
1919
import {
2020
BFactory
21-
} from "./configurable-rights-pool/contracts/test/BFactory.sol";
21+
} from "configurable-rights-pool/contracts/test/BFactory.sol";
2222

2323
import { ITier } from "./tier/ITier.sol";
2424

contracts/configurable-rights-pool

Lines changed: 0 additions & 1 deletion
This file was deleted.

0 commit comments

Comments
 (0)