Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue #106 #107

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
# Dependency directory
node_modules

package-lock.json

build
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We actually commit the build dir on purpose, because the rest of our stack pulls this repo in from npm and gets the abis from them


*.swp
*.txt

Expand Down
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,12 @@ Illustrated here are some of the main available calls:
- Users send transitive transactions with the hub, which has special permissions on tokens


## Docker Users

Clone down this repo and `docker-compose up`

See [docker-compose.yml](docker-compose.yml).

## Getting started

Requires [node version 12](https://nodejs.org/en/download/)
Expand Down
18 changes: 18 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
version: "3"
services:
ganache-cli:
image: trufflesuite/ganache-cli
container_name: ganache-cli
ports:
- "8145:8545"
#command: ["--accounts=100", "--hostname=0.0.0.0", "--gasLimit=100000000", "--defaultBalanceEther=1000000", "--mnemonic=xxx", "--networkId=99999"]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm fine with adding docker to this repo, but can you clean up these unused lines please?

circles-contracts:
image: node:12
container_name: circles-contracts
#environment:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This one too!

volumes:
- .:/usr/src/app:cached
entrypoint: |
bash -c "cd /usr/src/app
npm install
npm test"
26 changes: 26 additions & 0 deletions test/UBI.js
Original file line number Diff line number Diff line change
Expand Up @@ -325,6 +325,32 @@ contract('UBI', ([_, owner, recipient, attacker, systemOwner]) => { // eslint-di
bal.should.bignumber.satisfy(() => near(bal, goal, startingIssuance));
});

it('should show no payable ubi if timeout is shorter than period', async () => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can this be moved into its own describe block, and follows the pattern of deploying a hub in the before each like the rest of this file?

Would suggest to run a version of all the same tests we use on other hub parameters (and probably mostly use the same code):

  • should return that it is stopped when it has been manually stopped
  • should not payout ubi if manually stopped
  • should show no payable ubi if expired
  • should return that it is stopped when it has expired
  • should not payout ubi if expired

expired here meaning timeout has passed, and manually stopped meaning the stop method has been called

const period = new BigNumber(7885000000);
const timeout = new BigNumber(7885000000-1);

hubTimeoutShorterThanPeriod = await Hub
.new(
inflation,
period,
symbol,
name,
signupBonus,
startingIssuance,
timeout,
{ from: systemOwner, gas: maxGas },
);
const signup = await hubTimeoutShorterThanPeriod.signup({ from: owner, gas: 6721975 });
token = await Token.at(signup.logs[1].args.token);
deployTime = await getTimestampFromTx(signup.logs[0].transactionHash, web3);

const time = period.mul(bn(2));
await increase(time.toNumber() + 500);
await token.stop({ from: owner });
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Manually calling stop here means we're not actually letting the timeout come into effect

const bal = await token.look();
bal.should.be.bignumber.equal(bn(0));
});

it('doesnt change balance at deployment', async () => {
await token.update();
const balance = await token.balanceOf(owner);
Expand Down