Skip to content

Commit

Permalink
release version 0.11.4
Browse files Browse the repository at this point in the history
  • Loading branch information
kostysh committed Mar 4, 2020
1 parent 54b357d commit 31d3b86
Show file tree
Hide file tree
Showing 10 changed files with 119 additions and 28 deletions.
2 changes: 1 addition & 1 deletion .openzeppelin/project.json
Expand Up @@ -7,7 +7,7 @@
},
"dependencies": {},
"name": "org.id",
"version": "0.11.3",
"version": "0.11.4",
"publish": true,
"compiler": {
"manager": "openzeppelin",
Expand Down
11 changes: 11 additions & 0 deletions .openzeppelin/rinkeby-OrgId.json
@@ -0,0 +1,11 @@
{
"version": "0.11.4",
"contract": {
"name": "OrgId",
"implementation": "0xec4C42b2f8aF0d180D44E5Db0c2566041a57e4B5",
"proxy": "0x78E9C04D751F0a6baeDE7302099b73AB902e1af9"
},
"owner": "0xA0B74BFE28223c9e08d6DBFa74B5bf4Da763f959",
"proxyAdmin": null,
"blockNumber": 6080775
}
11 changes: 11 additions & 0 deletions .openzeppelin/ropsten-OrgId.json
@@ -0,0 +1,11 @@
{
"version": "0.11.4",
"contract": {
"name": "OrgId",
"implementation": "0xd863861E680B4C881A91fC92C36bAB1d09F8cd3A",
"proxy": "0xc8fD300bE7e4613bCa573ad820a6F1f0b915CfcA"
},
"owner": "0xA0B74BFE28223c9e08d6DBFa74B5bf4Da763f959",
"proxyAdmin": null,
"blockNumber": 7455603
}
94 changes: 72 additions & 22 deletions README.md
Expand Up @@ -9,6 +9,7 @@ Smart contract of the Winding Tree ORG.ID protocol

```bash
npm i
npm link
```

## Tests
Expand All @@ -34,47 +35,96 @@ npm run lint
## Generated docs
[OrgId](./docs/OrgId.md)

## Contracts ABI and addresses

Install the package

```bash
$ npm i @windingtree/org.id
```

Import ABIs in the your JavaScript code

```javascript
const { OrgIdContract, OrgIdInterfaceContract, addresses } = require('@windingtree/org.id');
```

Addresses of the deployed ORG.ID contract

```javascript
const { mainnet, ropsten, rinkeby } = addresses;
```

## ORG.ID Structure

![OrgId Structure](./assets/orgid-structure.png)

OrgId smart contract manages information about organizations and their Lif token deposits. Each organization record inside the contract storage contains following information:

- **orgId**: The organization unique Id. A hash that represents a hex value of the bytes32 string. This identifier can be generated by the organization owner by his own or automatically generated on the smart contract side at the moment of organization record creation.
- **orgJsonUri**: Offchain data. URI that points to the Organization JSON file available online. This file has to be created against the [ORG.ID JSON schema](https://github.com/windingtree/org.json-schema) rules.
- **orgJsonHash**: keccak256 hash of the ORG.ID JSON contents
- **parentEntity**: The parent organization Id
- **owner**: The organization owner
- **director**: The organization director. Only awailable for subsidiaries
- **state**: State of the organization (enabled or disabled)
- **directorConfirmed**: Flag is director ownership is confirmed. Director ownership confirmation os required for cases when director address is different from the parent organization owner address.
- **deposit**: Lif deposit value

Any organization registered at the OrgId smart contract can make a **deposit of Lif tokens**. Staking of this deposit is a part of a trust schema in the ORG.ID protocol. Deposits can be withdrawn but a certain delay is required between the withdraw request and real withdrawal. This delay is managed by the OrgId owner for now (community-managed in the future).

## Contract deployment

All deployments, upgrades, transactions and calls can be hadled using our [command line tools](./management/tools/README.md):
All deployments, upgrades, transactions, calls and complex tasks can be hadled using our [command line tools](./management/tools/README.md):

```bash
$ ./management/tools/index.js --network development cmd=contract name=OrgId initMethod=initialize initArgs=0x90F8bf6A479f320ead074411a4B0e7944Ea8c9C1 from=0x90F8bf6A479f320ead074411a4B0e7944Ea8c9C1
$ orgid-tools --network ropsten cmd=deploy name=OrgId from=0xA0B74BFE28223c9e08d6DBFa74B5bf4Da763f959 initMethod=initialize initArgs=0xA0B74BFE28223c9e08d6DBFa74B5bf4Da763f959,0xB6e225194a1C892770c43D4B529841C99b3DA1d7
```

The result will look like:

```bash
WindingTree Command Line Interface
Version: 0.10.0
Contract name: OrgId
Actual version: 0.10.0
Last known version: 0.10.0
App address: 0xe78A0F7E598Cc8b0Bb87894B0F60dD2a88d6a8Ab
Proxy admin: 0xD833215cBcc3f914bD1C9ece3EE7BF8B14f841bb
Contract implementation: 0x9561C133DD8580860B6b7E504bC5Aa500f0f06a7
New deployment
Contract proxy: 0x59d3631c86BbE35EF041872d502F218A39FBa150
Deployment of the contract: OrgId
Version: 0.11.4
Owner address: 0xA0B74BFE28223c9e08d6DBFa74B5bf4Da763f959
Initializing method: initialize
Initializing arguments: [ '0xA0B74BFE28223c9e08d6DBFa74B5bf4Da763f959',
'0xB6e225194a1C892770c43D4B529841C99b3DA1d7' ]
Contract deployed at address: 0xc8fD300bE7e4613bCa573ad820a6F1f0b915CfcA
```

Auto-generated deployment configuration will be saved on the `./openzeppelin` repository folder and will look like:

```json
{
"version": "0.10.0",
"version": "0.11.4",
"contract": {
"name": "OrgId",
"implementation": "0x9561C133DD8580860B6b7E504bC5Aa500f0f06a7",
"proxy": "0x59d3631c86BbE35EF041872d502F218A39FBa150"
"implementation": "0xd863861E680B4C881A91fC92C36bAB1d09F8cd3A",
"proxy": "0xc8fD300bE7e4613bCa573ad820a6F1f0b915CfcA"
},
"owner": "0x90F8bf6A479f320ead074411a4B0e7944Ea8c9C1",
"app": "0xe78A0F7E598Cc8b0Bb87894B0F60dD2a88d6a8Ab",
"proxyAdmin": "0xD833215cBcc3f914bD1C9ece3EE7BF8B14f841bb",
"implementationDirectory": "0xCfEB869F69431e42cdB54A4F4f105C19C080A601",
"package": "0x5b1869D9A4C187F2EAa108f3062412ecf0526b24",
"blockNumber": 9
"owner": "0xA0B74BFE28223c9e08d6DBFa74B5bf4Da763f959",
"proxyAdmin": null,
"blockNumber": 7455603
}
```

The filename of the configuration file is formed according to mask:
`./[NETWORK_NAME]-[CONTRACT_NAME].json`
`./<NETWORK_NAME>-<CONTRACT_NAME>.json`

## Contract upgrade

Upgrading of the contract is pretty similar to the deployment procedure but with a little difference. To be able to make an upgrade a configuration file (that had been created on the previous step) must already exist. So do not remove file with deployment information. In opposite case, the error message will be thrown and you will not be able to upgrade the contract. The second thing is a repository version. This version should be different from the previously deployed.

```bash
$ orgid-tools --network ropsten cmd=deploy name=OrgId from=0xA0B74BFE28223c9e08d6DBFa74B5bf4Da763f959 initMethod=setInterfaces
```

The result will look like:

```bash
Upgrading of the contract: OrgId
Version: 0.11.5
Owner address: 0xA0B74BFE28223c9e08d6DBFa74B5bf4Da763f959
Initializing method: setInterfaces
COntract upgraded at address: 0xc8fD300bE7e4613bCa573ad820a6F1f0b915CfcA
2 changes: 1 addition & 1 deletion assets/contracts-schema.drawio
@@ -1 +1 @@
<mxfile modified="2020-02-07T02:50:27.898Z" host="" agent="Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) draw.io/11.2.4 Chrome/76.0.3809.139 Electron/6.0.7 Safari/537.36" etag="ZdpcFA7NbEGprIDQfD22" version="11.2.4" type="device" pages="1"><diagram id="P1KJMvUTy4tlil_FxDQn" name="Page-1">7V3hc6I4FP9rnLn70A4QCPCxtt3du+tOd66729t+uYkSlVskboxt7V9/QYJAgoqKgNVOZ2oeIcJ7v/fLy8uDdsD1+PUjRZPRZ+LhoGNo3msH3HQMQzcNoxP9at48ljimFQuG1PdEp1Tw4L9hIdSEdOZ7eJrryAgJmD/JC/skDHGf5WSIUvKS7zYgQf5bJ2iIFcFDHwWq9NH32EhIdeimBz5hfzgSX+0YdnxgjJLO4k6mI+SRl4wI3HbANSWExZ/Gr9c4iJSX6CU+78OKo8sLozhkZU746+rX8Mn942I47t59u3q7Gd3+erzQTXFxbJ7cMfa4AkSTUDYiQxKi4DaVdimZhR6OhtV4K+1zR8iEC3Uu/A8zNhfWRDNGuGjExoE4il999k90+qUlWj/EYNHnm9dsY540QkbnmZOi5o9kvKiRnrZoJedNGaLsKkICF9z+PUahdx/i5MAHPwiWp3lptzdMyVfyGYXz+IjoF31ZrLBISysNIURTMqN90ct9ur9x7nw6x9+f+h9f5t7b8+AiATSiQ8zWWWkJF+5nmIwxv0F+HsUBYv5z/jqQAPxw2U+cym8OzTMdJsQP2TQz8pdIwDsI3wWmQLLwXNOV8CX1N3R3XX/+Ib6CpJW5lVS0wOwW+DXO+G0Xfgv7wWPAr2lpB8XvOg0+o2Am1HBP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1XgZ0snBT+0NrXf8D1Yc1Mjuf8bsdfhupD9sWv3J9WC343VQfJi/cfpvOelPf8xGd/17p/Id1z8J20fznQhugdA+kIN+pQGfl/KdbeZsAvekJsKHkyJlAYu23mUCADdpPIMZpEQjQ8zZpAYHoihrPBFIbgYA2E4hl5CvUW0kgahHvuyYQE+Zt0gICaSQtfCaQWPtmSQKxmyAQ6OgSIax/xAUCeQlewyNaasn2uyYQaORt0jyBqNvvSVmoot4WbvPtt540zbwxbKgY41BbfIW2UMuqT8YWQNPaZQu1/vpkbGFC0C5bqDXUJ2MLqDntsoVaJaIGoJtqfg9QZXdpbBVUVhgDFpTdbfOYfj1Vwroh1bOYTn6IshXCuvSAhelKA1VXHVysRTXnfeL4gyXxZzSJPyCtLUxjR/wBJz8QsGvGn5oybQn+svDTLvmiZQME1zw9UQku7ZK4BE3i0tIqwqVlNYxLdR3XElw2xYsFj/OszkA0hT8owcYEO+LPloAMnJrxB1W41Vgm3nROcZeE6G5Y3+tVUStigH0fQZODS21HEPO7k0CslQLxoV/+I+/l1vLyKt1uxKNOL7Nf9mHQbaKXfcNlaZ/JsuwdPQpIHuUexqMs2aOc9ZuV8uam1P9AHtWmZwrPHrVdPLavR9mSR8FdPcqUXmSotcOj5N2+WjzKKHh4c/naBXnrrum3MAxIyISX6lXtIMlVoqYYIrN6cIpWD+Zq/O5XDlDwZp5TMoghpSebN4i6j3RSBrGkPdbmDVLwQp5TMoit6S0zSAU7SrKe0pjLtPO5LNc098hm5XOsRrmXOVRT63wk20z5XXxbXsCX32aSBgLloqzK6horeLXRGlDqIAdKx3GPE5RHsff0fkBZwd7nalA6eUjuDki9QUAexabT+wGkcQbkBkAexS7UEQCSN9N/hhJ3T/+lDLj9Hw==</diagram></mxfile>
<mxfile modified="2020-03-04T21:26:49.089Z" host="" agent="Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) draw.io/11.2.4 Chrome/76.0.3809.139 Electron/6.0.7 Safari/537.36" etag="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jg3ARdyVOxoomKrrRoFoCbyjnxH+wfeUUvNxCk7WrJGwl5pLKpRsafmhrKpw78vXdfmpUqsyrMkMFuXGBK0HU2j48r1kduZQlf64fhyz2UZlu4LTrvDzH07MOt3CWaG1xDO6hZONIYzU8FZuXo3VkDHLTmrIq2adxZILCepBQmKisEQDRMOciHhBAfBqrhId/hU/dgmjpV+9VjRpa9tFT6yFWjuWFErO+/xkBMCNE0KNU9GEIamoL0hSfBm8WnMVIGKD4yCu/8B</diagram></mxfile>
Binary file removed assets/contracts-schema.png
Binary file not shown.
Binary file added assets/orgid-structure.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
23 changes: 21 additions & 2 deletions management/build-index.js
Expand Up @@ -2,24 +2,43 @@ const fs = require('fs');
const path = require('path');

const BASE_PATH = 'build/contracts';
const DEPLOYMENTS_PATH = '.openzeppelin';
const CONTRACTS_DIR = path.resolve(__dirname, `../${BASE_PATH}`);
const DEPLOYMENTS_DIR = path.resolve(__dirname, `../${DEPLOYMENTS_PATH}`);
const bundle = [
'OrgId.json',
'OrgIdInterface.json'
];
const deploymentsInfo = [
'mainnet-OrgId.json',
'ropsten-OrgId.json',
'rinkeby-OrgId.json'
];
const files = fs.readdirSync(CONTRACTS_DIR);
const deploymentsFiles = fs.readdirSync(DEPLOYMENTS_DIR);
const bundleRegex = new RegExp(bundle.join('|'));
const deploymentsRegex = new RegExp(deploymentsInfo.join('|'));
const importStatements = [];
const exportStatements = [];

files
.filter((f) => f.match(bundleRegex))
.map((f) => {
.filter(f => f.match(bundleRegex))
.map(f => {
const name = f.split('.')[0];
importStatements.push(`const ${name}Contract = require('./${BASE_PATH}/${f}');`);
exportStatements.push(` ${name}Contract: ${name}Contract,`);
});

const addresses = [];
deploymentsFiles
.filter(f => f.match(deploymentsRegex))
.map(f => {
const network = f.split('-')[0];
importStatements.push(`const ${network}Config = require('./${DEPLOYMENTS_PATH}/${f}');`);
addresses.push(` ${network}: ${network}Config.contract.proxy,`);
});
exportStatements.push(` addresses: {\n${addresses.join('\n')}\n }`);

const result = `
${importStatements.join('\n')}
Expand Down
2 changes: 1 addition & 1 deletion management/tools/commands/upgrade.js
Expand Up @@ -128,7 +128,7 @@ module.exports = async (options) => {
}
));

log('Proxy upgraded at address', proxy.address);
log('COntract upgraded at address', proxy.address);

// Creation of the deployment configuration file
deploymentConfig.version = packageJson.version;
Expand Down
2 changes: 1 addition & 1 deletion package.json
@@ -1,6 +1,6 @@
{
"name": "@windingtree/org.id",
"version": "0.11.3",
"version": "0.11.4",
"description": "ORG.ID smart contract",
"directories": {
"test": "test",
Expand Down

0 comments on commit 31d3b86

Please sign in to comment.