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

Refactor/reviewing contract code and comments #234

Merged
merged 12 commits into from Aug 26, 2019

Regenerating the documents.

  • Loading branch information
Freydal committed Aug 26, 2019
commit eed67b7c45de136949f24cf5f2086c80b06e0f0d
@@ -1,6 +1,6 @@
# AuthorizedAddresses

Common registry of system contract addresses authrorized to access internal methods.
Common registry of system contract addresses authorized to access internal methods.

## Contents

@@ -30,7 +30,7 @@ function authorizeAddress(a address) public

### isAddressAuthorized

Verify if address is authorized by reading contract mapping
Verify address authorization.

#### Signature

@@ -40,13 +40,13 @@ function isAddressAuthorized(a address) public view (bool)

#### Parameters:

| Parameter | Type | Description |
| --------- | --------- | -------------------------------- |
| `a` | `address` | Address to get authorized value. |
| Parameter | Type | Description |
| --------- | --------- | --------------------- |
| `a` | `address` | Address to authorize. |

#### Returns:

True if the address is authorized, false otherwise.
Address authorization

### transferOwnership

@@ -66,7 +66,7 @@ function transferOwnership(newOwner address) public

### unauthorizeAddress

Unauthorizes the address by setting the mapping value to false.
Disables the address previous authorization by setting the mapping value to false.

#### Signature

@@ -1,6 +1,6 @@
# EventEmitter

A shared contract for all Kosu system contracts to trigger event logs through.
A central event emitting contract supporting the Kosu contract system.

## Contents

@@ -28,7 +28,7 @@ constructor(auth address) public

### emitEvent

Emit generic events which can have decoding exposed though javascript library.
Emits a standard event from the Kosu contract system. The events can be decoded though the javascript library.

#### Signature

@@ -38,8 +38,8 @@ function emitEvent(eventType string, data bytes32[], stringData string) public

#### Parameters:

| Parameter | Type | Description |
| ------------ | ----------- | -------------------------------------------------------------- |
| `eventType` | `string` | String name/type of event |
| `data` | `bytes32[]` | Bytes32 encoded data to be emitted from a centralized location |
| `stringData` | `string` | String containing optional additonal information |
| Parameter | Type | Description |
| ------------ | ----------- | -------------------------------------------------- |
| `eventType` | `string` | String name/type of event. |
| `data` | `bytes32[]` | Bytes32 encoded data to be emitted. |
| `stringData` | `string` | String containing optional additional information. |
@@ -1,6 +1,6 @@
# KosuToken

KosuToken (KOSU) is an implentation of the ERC-20 interface and supporting bonding curve for mints and burns.
KosuToken (KOSU) is an implementation of the ERC-20 interface and supporting bonding curve for mints and burns.

## Contents

@@ -14,7 +14,6 @@ KosuToken (KOSU) is an implentation of the ERC-20 interface and supporting bondi
- [estimateEtherToToken](#estimateethertotoken)
- [estimateTokenToEther](#estimatetokentoether)
- [increaseAllowance](#increaseallowance)
- [mint](#mint)
- [mintTo](#mintto)
- [releaseTokens](#releasetokens)
- [transfer](#transfer)
@@ -82,7 +81,7 @@ An uint256 representing the amount owned by the passed address.

### bondTokens

Uses the ether paid to calculate and mint tokens.
Receives ether as a backing currency to be used against the bonding curve to mint tokens.

#### Signature

@@ -98,7 +97,7 @@ function bondTokens(minPayout uint256) public (uint256)

### burn

Burn tokens
Voluntarily burn tokens.

#### Signature

@@ -108,9 +107,9 @@ function burn(amount uint256) public

#### Parameters:

| Parameter | Type | Description |
| --------- | --------- | --------------------------- |
| `amount` | `uint256` | Number of tokens to destroy |
| Parameter | Type | Description |
| --------- | --------- | ------------------------- |
| `amount` | `uint256` | Number of tokens to burn. |

### decreaseAllowance

@@ -131,7 +130,7 @@ function decreaseAllowance(spender address, subtractedValue uint256) public (boo
### estimateEtherToToken
Estimates the number of tokens to generate with the input ether at the current state.
Estimates the number of tokens that would be minted with the input ether at the current ether and token balances.
#### Signature
@@ -141,17 +140,17 @@ function estimateEtherToToken(input uint256) public view (uint256)
#### Parameters:
| Parameter | Type | Description |
| --------- | --------- | --------------------------------- |
| `input` | `uint256` | The amount of ether to contribute |
| Parameter | Type | Description |
| --------- | --------- | ---------------------------------- |
| `input` | `uint256` | The amount of ether to contribute. |
#### Returns:
Number of tokens that would be generated
Number of tokens that would be minted.
### estimateTokenToEther
Estimates the amount of ether to return with the input number of tokens to burn.
Estimates the amount of ether to be released with the input number of tokens to burn.
#### Signature
@@ -161,13 +160,13 @@ function estimateTokenToEther(input uint256) public view (uint256)
#### Parameters:
| Parameter | Type | Description |
| --------- | --------- | ---------------------------- |
| `input` | `uint256` | The number of tokens to burn |
| Parameter | Type | Description |
| --------- | --------- | ----------------------------- |
| `input` | `uint256` | The number of tokens to burn. |
#### Returns:
Amount of ether to receive
Amount of ether to release.
### increaseAllowance
@@ -186,25 +185,9 @@ function increaseAllowance(spender address, addedValue uint256) public (bool)
| `spender` | `address` | The address which will spend the funds. |
| `addedValue` | `uint256` | The amount of tokens to increase the allowance by. |
### mint
Mint tokens
#### Signature
```solidity
function mint(amount uint256) public
```
#### Parameters:
| Parameter | Type | Description |
| --------- | --------- | -------------------------- |
| `amount` | `uint256` | Number of tokens to create |
### mintTo
Mint tokens to specified address
Authorized addresses (mostly contract systems) may manually mint new tokens to desired addresses.
#### Signature
@@ -214,14 +197,14 @@ function mintTo(_address address, amount uint256) public
#### Parameters:
| Parameter | Type | Description |
| ---------- | --------- | --------------------------- |
| `_address` | `address` | Address to receive tokens |
| `amount` | `uint256` | Number of tokens to create. |
| Parameter | Type | Description |
| ---------- | --------- | -------------------------- |
| `_address` | `address` | Address to mint tokens to. |
| `amount` | `uint256` | Number of tokens to mint. |
### releaseTokens
Burns the input amount of tokens returning the calculated amount of ether.
Burns the input tokens and releases the calculated amount of ether backing the tokens destroyed.
#### Signature
@@ -231,9 +214,9 @@ function releaseTokens(tokensToBurn uint256) public
#### Parameters:
| Parameter | Type | Description |
| -------------- | --------- | ---------------------------- |
| `tokensToBurn` | `uint256` | The number of tokens to burn |
| Parameter | Type | Description |
| -------------- | --------- | --------------------------------------- |
| `tokensToBurn` | `uint256` | The number of the users tokens to burn. |
### transfer
@@ -1,6 +1,6 @@
# OrderGateway

Access SubContract implementation's methods to participate in trades and check order status.
Serves as a message router for SubContract implementations. Passing SubContract method calls through the gateway allows for a single watch point for incoming participate transactions.

## Contents

@@ -14,7 +14,7 @@ Access SubContract implementation's methods to participate in trades and check o

### amountRemaining

Calls amountRemaining on provided subContract.
Forwards function calls of amountRemaining to the provided subContract address.

#### Signature

@@ -24,18 +24,18 @@ function amountRemaining(subContract address, data bytes) public view (uint256)

#### Parameters:

| Parameter | Type | Description |
| ------------- | --------- | ------------------------------------------------------------------- |
| `subContract` | `address` | Address of contract implementing the SubContract interface. |
| `data` | `bytes` | Encoded maker values for Order encoded based on the makerArguments. |
| Parameter | Type | Description |
| ------------- | --------- | ---------------------------------------------------------------------------------------------------- |
| `subContract` | `address` | Address of contract implementing the SubContract interface. |
| `data` | `bytes` | Encoded values for Order encoded in accordance to the arguments exposed by the provided subContract. |

#### Returns:

Quantity of available asset for Order encoded in makerData.
Quantity of available asset for Order encoded in data.

### arguments

Calls arguments on provided subContract.
Forwards function calls of arguments to the provided subContract address.

#### Signature

@@ -51,11 +51,11 @@ function arguments(subContract address) public view (string)

#### Returns:

String encoded JSON representation of subContract maker arguments.
JSON string providing expected structure of subContract input data.

### isValid

Calls isValid on provided subContract.
Forwards function calls of isValid to the provided subContract address.

#### Signature

@@ -65,18 +65,18 @@ function isValid(subContract address, data bytes) public view (bool)

#### Parameters:

| Parameter | Type | Description |
| ------------- | --------- | ------------------------------------------------------------------- |
| `subContract` | `address` | Address of contract implementing the SubContract interface. |
| `data` | `bytes` | Encoded maker values for Order encoded based on the makerArguments. |
| Parameter | Type | Description |
| ------------- | --------- | ---------------------------------------------------------------------------------------------------- |
| `subContract` | `address` | Address of contract implementing the SubContract interface. |
| `data` | `bytes` | Encoded values for Order encoded in accordance to the arguments exposed by the provided subContract. |

#### Returns:

Boolean representing the validity of makerData.
Boolean representing the validity of data.

### participate

Calls participate on the provided subContract.
Forwards function calls of participate to the provided subContract address.

#### Signature

@@ -86,11 +86,11 @@ function participate(subContract address, data bytes) public (bool)

#### Parameters:

| Parameter | Type | Description |
| ------------- | --------- | -------------------------------------------------------------- |
| `subContract` | `address` | Address of contract implementing the SubContract interface. |
| `data` | `bytes` | Encoded maker values for Order encoded based on the arguments. |
| Parameter | Type | Description |
| ------------- | --------- | ---------------------------------------------------------------------------------------------------- |
| `subContract` | `address` | Address of contract implementing the SubContract interface. |
| `data` | `bytes` | Encoded values for Order encoded in accordance to the arguments exposed by the provided subContract. |

#### Returns:

Boolean representing success of transaction.
Boolean representing result of transaction.
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.