https://github.com/hasheddan/waterloocontracts
https://github.com/hasheddan/waterloocontracts
Last synced: about 1 month ago
JSON representation
- Host: GitHub
- URL: https://github.com/hasheddan/waterloocontracts
- Owner: hasheddan
- Created: 2017-10-14T03:50:31.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2017-10-15T10:56:45.000Z (over 8 years ago)
- Last Synced: 2025-03-21T02:12:55.439Z (over 1 year ago)
- Language: JavaScript
- Size: 11.5 MB
- Stars: 3
- Watchers: 1
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# **Congruence**
---
## Setup
Clone repository:
```git clone```
Install dependencies:
```npm install```
## Run
#### Start testrpc (with 0x) and server
```npm start```
#### Start testrpc (with 0x) only
```npm run testrpc```
*__Note__: testrpc default port is 8545*
#### Start server only
```npm run server```
*__Note__: server default port is 8000*
## API
#### POST: ```/create```: creates tokens and returns transaction hash
- *initialAmount*: (integer) amount of tokens to be issued
- *name*: (string) token name
- *symbol*: (string) 3 or 4 letter token symbol
- *expirationDate*: (integer) number of days that tokens are valid for
__Example__:
```
{
“initialAmount”: 100,
“name”:“pizza”,
“symbol”:“PIZ”,
“expirationDate”: 40
}
```
#### GET: ```/accounts```: returns public keys of all accounts
#### POST: ```/createOrder```: creates order and returns hash of order
- *maker*: (address) address of order maker
- *makerTokenAddress*: (address) address of token order maker
- *makerTokenAmount*: (integer) number of tokens maker is proposing trading in order
- *takerTokenAmount*: (integer) number of tokens maker is expecting to recieve from taker
__Example__:
```
{
“maker”: “0x5409ed021d9299bf6814279a6a1411a7e866a631",
“takerTokenAddress”: “0x48bacb9266a570d521063ef5dd96e61686dbe788",
“makerTokenAddress”: “0x18bbba441315bab82d032b8c4e531fb050ea2d4c”,
“makerTokenAmount”: “2",
“takerTokenAmount”: “1"
}
```
#### GET: ```/fillOrder```: executes order and returns transaction hash
- *form*: (JSON object) JSON object obtained from order in the exchange
- *address*: (address) address of user who will be buying the tokens (taker)
- *number*: (integer) number of tokens the taker will buy
#### GET: ```/exchange```: returns all outstanding orders
#### GET: ```/tokens```: returns all outstanding tokens
#### POST: ```/getBalance```: returns amount of each token held by owner of address paramater
- *address*: (address) address of user who's token balances we desire to know