Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
be63d5c
Repo: update readme narrative information and installation and usage …
Apr 30, 2019
f3c582f
Repo: clarify certain comments and remove extraneous elements from re…
May 2, 2019
40002b2
Merge pull request #10 from jasonklein/banks/gh1/add-readme
schemar May 2, 2019
a508b20
Added example of typechain
May 3, 2019
1bedfe4
Deleted commited contract wrappers
May 3, 2019
b580551
added script of generating wrapper and added types into git ignore
May 3, 2019
2bf9cbc
Added post install script
May 3, 2019
636f640
Add SafeMath as npm dependency
schemar May 7, 2019
40ffcfe
Merge remote-tracking branch 'upstream/develop' into type_chain_example
May 9, 2019
c13786c
Added output directoryt and not generating interacts for Migrations
May 9, 2019
1591eab
Removed script for manual test
May 9, 2019
613d76b
Merge pull request #11 from schemar/npm_safe_math
schemar May 9, 2019
8531976
Removed caret operator from the typeschain dependency
May 9, 2019
8a2b98f
Merge pull request #12 from sarvesh-ost/interacts_with_type_chain
schemar May 13, 2019
696c18f
Fixes lint-errors and integrates linting in Travis
May 15, 2019
6243f39
Runs ganache in background in .travis.yml
May 15, 2019
6145cdf
Aligns setAdmin() docs with implementation
May 15, 2019
562494f
Removes --reset option from `truffle compile`
May 15, 2019
f79767b
Merge pull request #15 from pgev/fix-lint-issues
gulshanvasnani May 16, 2019
26ab0c1
Merge pull request #16 from pgev/docs-mismatch-setAdmin
schemar May 17, 2019
aebb3ac
Update truffle dependency
schemar May 29, 2019
abc1966
Updated ganache-cli to 6.4.3
gulshanvasnani May 29, 2019
210d5db
Merge pull request #18 from gulshanvasnani/update_ganache_6.4.3
abhayks1 May 30, 2019
daa1930
Removed safemath import from organization contracts
gulshanvasnani May 30, 2019
9ffc1aa
Removed newline
gulshanvasnani May 30, 2019
710caed
Merge pull request #19 from gulshanvasnani/remove_safemath
0xsarvesh May 30, 2019
486e4cc
Resolved package.json conflict.
May 30, 2019
e37e6c8
Merge pull request #17 from schemar/truffle
0xsarvesh May 30, 2019
af019ee
updating versions for vulnerable NPM modules
Jun 3, 2019
ae5da0a
Merge pull request #21 from puneet-khushwani-eth/GH-20
Jun 3, 2019
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
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
.idea/
.vscode/
*.iml
*.swp
tags

# don't commit node_modules
node_modules
Expand All @@ -14,3 +16,6 @@ build/

# NPM package generated files:
dist/contracts.json

# Do not track generated wrapper, it should be part of build script
interacts/*
7 changes: 4 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,12 @@ before_install:
- sudo apt-get install nodejs
- sudo apt-get install npm
install:
- npm install
- npm ci
before_script:
- ./tools/runGanacheCli.sh </dev/null 1>/dev/null 2>&1 &
- npm run compile
- npm run ganache </dev/null 1>/dev/null 2>&1 &
- npm run compile-all
script:
- npm run lint
- npm run test
- npm run build-package
after_script:
Expand Down
90 changes: 69 additions & 21 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,56 +2,104 @@

![Build master](https://img.shields.io/travis/OpenST/organization-contracts/master.svg?label=build%20master&style=flat)
![Build develop](https://img.shields.io/travis/OpenST/organization-contracts/develop.svg?label=build%20develop&style=flat)
![npm version](https://img.shields.io/npm/v/@openstfoundation/organization-contracts.svg?style=flat)
[![Discuss on Discourse](https://img.shields.io/discourse/https/discuss.openst.org/topics.svg?style=flat)][discourse]
[![Chat on Gitter](https://img.shields.io/gitter/room/OpenSTFoundation/SimpleToken.svg?style=flat)][gitter]
[![Chat on Gitter](https://img.shields.io/gitter/room/ostdotcom/OST-Platform.svg?style=flat)][gitter]

Organization contracts manage application permissions.
An organization administers other contracts. For an individual contract or a system of contracts, an organization enables limiting execution of certain functions to the organization or other accounts it authorizes (e.g., "workers").

## Instructions
## Getting Started

### Installation
These instructions will get you a copy of the project up and running on your local machine for development and testing purposes.

> Please add
### Prerequisites

### Usage
Project requires [node] and [npm] to be installed.

> Please add
### Cloning

## Related Work

[mosaic-contracts] and [openst-contracts] use this package to manage access control.
```bash
git clone git@github.com:OpenST/organization-contracts.git
```

## Contributing
### Installing

### Set-up
Install npm packages:

```bash
git clone git@github.com:OpenST/organization-contracts.git
cd organization-contracts
npm install
```
## Usage

The contracts and interfaces in this repository are primarily intended for use in other OpenST projects. Please see [Related Work].

### Compiling the contracts

The following npm script compiles updated contracts since the last compile using [truffle]:

```bash
npm run compile
```

To compile all contracts, including the ones that haven't changed:

```bash
npm run compile-all
npm run ganache
npm run test
```

### Guidelines
### Testing the contracts

We use the [ganache] blockchain for development. Before running the tests, start `ganache`:

```bash
npm run ganache-cli
```

Test the contracts using [truffle]:

```bash
npm test
```

### Linting

[ESLint] is used to lint js files.

To lint all js files within the `./test` and `./tool` directories, run:

```bash
npm run lint
```

## Related Work

OpenST uses organization contracts and interfaces in [mosaic-contracts], [brandedtoken-contracts], and [openst-contracts] to scale, create, and define blockchain token economies.

## Contributing

There are multiple ways to contribute to this project. However, before contributing, please first review the [Code of Conduct].

We track our [issues] on GitHub.

To contribute code, please ensure that your read the [developer guidelines] first.
To contribute code, please review our [Developer Guidelines] and ensure that your submissions adhere to the [Style Guide]; please also be aware, this project is under active development and we have not yet established firm contribution guidelines or acceptance criteria.

### Community

* [Forum][discourse]
* [Gitter]

[code of conduct]: https://github.com/OpenST/developer-guidelines/blob/develop/CODE_OF_CONDUCT.md
[brandedtoken-contracts]: https://github.com/OpenSTFoundation/brandedtoken-contracts
[code of conduct]: https://github.com/OpenST/developer-guidelines/blob/master/CODE_OF_CONDUCT.md
[developer guidelines]: https://github.com/OpenST/developer-guidelines
[discourse]: https://discuss.openst.org/
[gitter]: https://gitter.im/OpenSTFoundation/SimpleToken
[eslint]: https://eslint.org
[ganache]: https://github.com/trufflesuite/ganache
[gitter]: https://gitter.im/ostdotcom/OST-Platform
[issues]: https://github.com/OpenST/organization-contracts/issues
[mosaic-contracts]: https://github.com/OpenSTFoundation/mosaic-contracts
[node]: https://nodejs.org/en/
[npm]: https://www.npmjs.com/get-npm
[openst-contracts]: https://github.com/OpenSTFoundation/openst-contracts
[issues]: https://github.com/OpenST/organization-contracts/issues
[related work]: #related-work
[style guide]: https://github.com/OpenST/developer-guidelines/blob/master/SOLIDITY_STYLE_GUIDE.md
[truffle]: https://github.com/trufflesuite/truffle
41 changes: 17 additions & 24 deletions contracts/Organization.sol
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,8 @@ pragma solidity ^0.5.0;
//
// ----------------------------------------------------------------------------

import "./lib/SafeMath.sol";
import "./OrganizationInterface.sol";


/**
* @title Organization contract handles an organization and its workers.
*
Expand All @@ -36,12 +34,6 @@ import "./OrganizationInterface.sol";
*/
contract Organization is OrganizationInterface {


/* Using */

using SafeMath for uint256;


/* Events */

/** Emitted when a current owner initiates a change of ownership. */
Expand Down Expand Up @@ -211,14 +203,16 @@ contract Organization is OrganizationInterface {
}

/**
* @notice Sets the admin address. Can only be called by owner or current
* admin. If called by the current admin, adminship is transferred
* to the given address immediately.
* It is discouraged to set the admin address to be the same as the
* address of the owner. The point of the admin is to act on behalf
* of the organization without requiring the possibly very safely
* stored owner key(s).
* Admin can be set to `address(0)` if no admin is desired.
* @notice Sets a new admin address.
*
* An admin address can be set to `address(0)` if no admin is
* desired.
*
* Requires:
* - Only owner or admin can call.
* - A new admin address is not the same as the current
* owner address.
*
*
* @param _admin Admin address to be set.
*
Expand All @@ -231,14 +225,13 @@ contract Organization is OrganizationInterface {
onlyOwnerOrAdmin
returns (bool success_)
{
/*
* If the address does not change, the call is considered a success,
* but we don't need to emit an event as it did not actually change.
*/
if (admin != _admin) {
emit AdminAddressChanged(_admin, admin);
admin = _admin;
}
require(
owner != _admin,
"A new admin address is the same as the current owner."
);

emit AdminAddressChanged(_admin, admin);
admin = _admin;

success_ = true;
}
Expand Down
143 changes: 0 additions & 143 deletions contracts/lib/SafeMath.sol

This file was deleted.

Loading