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

Added docs for the Solidity code #799

Merged
merged 22 commits into from
Oct 5, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
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
29 changes: 26 additions & 3 deletions .drone.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,35 @@ pipeline:
- make install_tools
when:
event: [pull_request]

truffle_node_modules:
group: truffle_setup
image: kowalatech/go:1.0.12
commands:
- make client/contracts/truffle/node_modules
when:
event: [pull_request]

build_solidity_docs:
group: solidity_docs
image: kowalatech/solidoc:1.0.3
commands:
- make solidoc_generate
when:
event: [pull_request]

go_generate:
group: generate
image: kowalatech/go:1.0.12
commands:
- make go_generate
when:
event: [pull_request]

assert_no_changes:
group: assert_no_changes
image: kowalatech/go:1.0.12
commands:
- make assert_no_changes
when:
event: [pull_request]
Expand Down Expand Up @@ -374,15 +397,15 @@ pipeline:
when:
branch: [dev]
event: [push]

build_docs:
group: build_artifacts
image: kowalatech/mkdocs
commands:
- make build_docs
when:
event: [push,tag]
branch: [master,dev]
event: [push]
branch: [dev]

build_cdn:
group: build_artifacts
Expand Down
13 changes: 12 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -106,14 +106,25 @@ go_generate: client/contracts/truffle/node_modules
go generate ./client/contracts/bindings/utils/namehash.go
go generate ./...

# This is designed to be run inside a kowalatech/solidoc container
.PHONY: solidoc_generate
solidoc_generate: client/contracts/truffle/node_modules
dotnet /app/bin/Release/netcoreapp2.1/publish/Solidoc.dll /go/src/github.com/kowala-tech/kcoin/client/contracts/truffle /go/src/github.com/kowala-tech/kcoin/docs/docs/smartcontracts

.PHONY: docker_generate
docker_generate: docker_go_generate docker_solidoc_generate

.PHONY: docker_go_generate
docker_go_generate:
docker run --rm -v $(PWD):/go/src/github.com/kowala-tech/kcoin -w /go/src/github.com/kowala-tech/kcoin kowalatech/go:1.0.12 make install_tools go_generate

docker_solidoc_generate:
docker run --rm -it -v $(PWD)/client/contracts/truffle/:/src -v $(PWD)/docs/docs/smartcontracts:/out kowalatech/solidoc:1.0.3 /src /out

.PHONY: assert_no_changes
assert_no_changes:
git status
@if ! git diff-index --quiet HEAD; then echo 'There are uncommited go generate files.\nRun `make docker_go_generate` to regenerate all of them.'; exit 1; fi
@if ! git diff-index --quiet HEAD; then echo 'There are uncommited generated files.\nRun `make docker_generate` to regenerate all of them.'; exit 1; fi

.PHONY: notifications_dep
notifications_dep: dep
Expand Down
2 changes: 1 addition & 1 deletion client/contracts/bindings/oracle/build/ExchangeMgr.bin

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion client/contracts/bindings/oracle/gen_exchange.go

Large diffs are not rendered by default.

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion client/contracts/bindings/oracle/testfiles/gen_exchange.go

Large diffs are not rendered by default.

16 changes: 16 additions & 0 deletions client/contracts/truffle/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -108,3 +108,19 @@ const knsv1 = await KNSV1.new();
await knsProxy.upgradeTo(knsv1.address, { from: admin });
knsContract = await KNSV1.at(knsProxyAddress);
```

# How to generate solidity documentation
We are using docker image with built in tool from https://github.com/binodnp/solidoc to generate our documentation for Solidity.

In the main folder of truffle you will need to do these steps:

1. Build docker image : `docker build . -t kowalatech/solidoc`
2. Run docker image : `docker run --rm -it -v absolute/path/to/the/project/kcoin/client/contracts/truffle/:/src -v aboslute/path/to/the/project/kcoin/client/contracts/truffle/docs:/out kowalatech/solidoc /src /out`

First argument is the project path and second is the output folder where all generated docs will be.

Or, from the kcoin root:

```
make docker_solidoc_generate
```
4 changes: 2 additions & 2 deletions client/contracts/truffle/contracts/oracle/ExchangeMgr.sol
Original file line number Diff line number Diff line change
Expand Up @@ -107,15 +107,15 @@ contract ExchangeMgr is Pausable, Initializable {
}

/**
* @dev checks whether the given name is an exchange or not
* @dev checks whether the given name is a whitelisted exchange or not
* @param name exchange name.
*/
function isExchange(string name) public view returns (bool isIndeed) {
return exchangeRegistry[name].isExchange;
}

/**
* @dev checks whether the given name is an whitelisted exchange or not
* @dev checks whether the given name is a whitelisted exchange or not
* @param name exchange name.
*/
function isWhitelistedExchange(string name) public view returns (bool isIndeed) {
Expand Down
72 changes: 72 additions & 0 deletions docs/docs/smartcontracts/BalanceContract.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
# BalanceContract.sol

**contract BalanceContract is [TokenReceiver](TokenReceiver.md)**

**BalanceContract**

## Contract Members
**Constants & Variables**

```js
//internal members
address internal owner;
bytes internal data;
//public members
address public from;
uint256 public value;
```

## Functions

- [tokenFallback](#tokenfallback)

### tokenFallback

:small_red_triangle: overrides [TokenReceiver.tokenFallback](TokenReceiver.md#tokenfallback)

```js
function tokenFallback(address _from, uint256 _value, bytes _data) public
```

**Arguments**

| Name | Type | Description |
| ------------- |------------- | -----|
| _from | address | |
| _value | uint256 | |
| _data | bytes | |

## Contracts

- [BalanceContract](BalanceContract.md)
- [CappedToken](CappedToken.md)
- [Consensus](Consensus.md)
- [ConsensusMock](ConsensusMock.md)
- [DomainResolver](DomainResolver.md)
- [DomainResolverMock](DomainResolverMock.md)
- [ExchangeMgr](ExchangeMgr.md)
- [FIFSRegistrar](FIFSRegistrar.md)
- [Initializable](Initializable.md)
- [KNS](KNS.md)
- [KNSRegistry](KNSRegistry.md)
- [KNSRegistryV1](KNSRegistryV1.md)
- [KRC223](KRC223.md)
- [Math](Math.md)
- [Migrations](Migrations.md)
- [MiningToken](MiningToken.md)
- [MintableToken](MintableToken.md)
- [MultiSigWallet](MultiSigWallet.md)
- [NameHash](NameHash.md)
- [OracleMgr](OracleMgr.md)
- [Ownable](Ownable.md)
- [Pausable](Pausable.md)
- [PriceProvider](PriceProvider.md)
- [PublicResolver](PublicResolver.md)
- [SafeMath](SafeMath.md)
- [Stability](Stability.md)
- [strings](strings.md)
- [SystemVars](SystemVars.md)
- [Token](Token.md)
- [TokenMock](TokenMock.md)
- [TokenReceiver](TokenReceiver.md)
- [ValidatorMgr](ValidatorMgr.md)
75 changes: 75 additions & 0 deletions docs/docs/smartcontracts/CappedToken.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
# Capped token (CappedToken.sol)

**contract CappedToken is [MintableToken](MintableToken.md)**

**CappedToken**

Mintable token with a token cap.

## Contract Members
**Constants & Variables**

```js
uint256 public cap;
```

## Functions

- [mint](#mint)

### mint

:small_red_triangle: overrides [MintableToken.mint](MintableToken.md#mint)

Function to mint tokens

```js
function mint(address _to, uint256 _amount) public onlyOwner canMint
returns(bool)
```

**Returns**

A boolean that indicates if the operation was successful.

**Arguments**

| Name | Type | Description |
| ------------- |------------- | -----|
| _to | address | The address that will receive the minted tokens. |
| _amount | uint256 | The amount of tokens to mint. |

## Contracts

- [BalanceContract](BalanceContract.md)
- [CappedToken](CappedToken.md)
- [Consensus](Consensus.md)
- [ConsensusMock](ConsensusMock.md)
- [DomainResolver](DomainResolver.md)
- [DomainResolverMock](DomainResolverMock.md)
- [ExchangeMgr](ExchangeMgr.md)
- [FIFSRegistrar](FIFSRegistrar.md)
- [Initializable](Initializable.md)
- [KNS](KNS.md)
- [KNSRegistry](KNSRegistry.md)
- [KNSRegistryV1](KNSRegistryV1.md)
- [KRC223](KRC223.md)
- [Math](Math.md)
- [Migrations](Migrations.md)
- [MiningToken](MiningToken.md)
- [MintableToken](MintableToken.md)
- [MultiSigWallet](MultiSigWallet.md)
- [NameHash](NameHash.md)
- [OracleMgr](OracleMgr.md)
- [Ownable](Ownable.md)
- [Pausable](Pausable.md)
- [PriceProvider](PriceProvider.md)
- [PublicResolver](PublicResolver.md)
- [SafeMath](SafeMath.md)
- [Stability](Stability.md)
- [strings](strings.md)
- [SystemVars](SystemVars.md)
- [Token](Token.md)
- [TokenMock](TokenMock.md)
- [TokenReceiver](TokenReceiver.md)
- [ValidatorMgr](ValidatorMgr.md)
55 changes: 55 additions & 0 deletions docs/docs/smartcontracts/Consensus.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
# Consensus.sol

**Consensus**

## Functions

- [isSuperNode](#issupernode)

### isSuperNode

```js
function isSuperNode(address identity) public view
returns(bool)
```

**Arguments**

| Name | Type | Description |
| ------------- |------------- | -----|
| identity | address | |

## Contracts

- [BalanceContract](BalanceContract.md)
- [CappedToken](CappedToken.md)
- [Consensus](Consensus.md)
- [ConsensusMock](ConsensusMock.md)
- [DomainResolver](DomainResolver.md)
- [DomainResolverMock](DomainResolverMock.md)
- [ExchangeMgr](ExchangeMgr.md)
- [FIFSRegistrar](FIFSRegistrar.md)
- [Initializable](Initializable.md)
- [KNS](KNS.md)
- [KNSRegistry](KNSRegistry.md)
- [KNSRegistryV1](KNSRegistryV1.md)
- [KRC223](KRC223.md)
- [Math](Math.md)
- [Migrations](Migrations.md)
- [MiningToken](MiningToken.md)
- [MintableToken](MintableToken.md)
- [MultiSigWallet](MultiSigWallet.md)
- [NameHash](NameHash.md)
- [OracleMgr](OracleMgr.md)
- [Ownable](Ownable.md)
- [Pausable](Pausable.md)
- [PriceProvider](PriceProvider.md)
- [PublicResolver](PublicResolver.md)
- [SafeMath](SafeMath.md)
- [Stability](Stability.md)
- [strings](strings.md)
- [SystemVars](SystemVars.md)
- [Token](Token.md)
- [TokenMock](TokenMock.md)
- [TokenReceiver](TokenReceiver.md)
- [ValidatorMgr](ValidatorMgr.md)
62 changes: 62 additions & 0 deletions docs/docs/smartcontracts/ConsensusMock.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
# ConsensusMock.sol

**ConsensusMock**

## Contract Members
**Constants & Variables**

```js
bool internal superNode;
```

## Functions

- [isSuperNode](#issupernode)

### isSuperNode

```js
function isSuperNode(address identity) public view
returns(bool)
```

**Arguments**

| Name | Type | Description |
| ------------- |------------- | -----|
| identity | address | |

## Contracts

- [BalanceContract](BalanceContract.md)
- [CappedToken](CappedToken.md)
- [Consensus](Consensus.md)
- [ConsensusMock](ConsensusMock.md)
- [DomainResolver](DomainResolver.md)
- [DomainResolverMock](DomainResolverMock.md)
- [ExchangeMgr](ExchangeMgr.md)
- [FIFSRegistrar](FIFSRegistrar.md)
- [Initializable](Initializable.md)
- [KNS](KNS.md)
- [KNSRegistry](KNSRegistry.md)
- [KNSRegistryV1](KNSRegistryV1.md)
- [KRC223](KRC223.md)
- [Math](Math.md)
- [Migrations](Migrations.md)
- [MiningToken](MiningToken.md)
- [MintableToken](MintableToken.md)
- [MultiSigWallet](MultiSigWallet.md)
- [NameHash](NameHash.md)
- [OracleMgr](OracleMgr.md)
- [Ownable](Ownable.md)
- [Pausable](Pausable.md)
- [PriceProvider](PriceProvider.md)
- [PublicResolver](PublicResolver.md)
- [SafeMath](SafeMath.md)
- [Stability](Stability.md)
- [strings](strings.md)
- [SystemVars](SystemVars.md)
- [Token](Token.md)
- [TokenMock](TokenMock.md)
- [TokenReceiver](TokenReceiver.md)
- [ValidatorMgr](ValidatorMgr.md)
Loading