raiden-network/raiden-token

Name: raiden-token

Owner: raiden-network

Description: Raiden Token and Issuance Contracts

Created: 2017-06-05 14:11:03.0

Updated: 2018-01-05 22:33:25.0

Pushed: 2018-01-11 20:57:17.0

Homepage: null

Size: 467

Language: Python

GitHub Committers

UserMost Recent Commit# Commits

Other Committers

UserEmailMost Recent Commit# Commits

README

Raiden Token

Smart Contracts, Unittests and Infrastructure.
Installation
Prerequisites Setup Usage
mpilation
lus compile

sts
st -p no:warnings -s
st tests/test_auction.py -p no:warnings -s

commended:
install pytest-xdist
st -p no:warnings -s -n NUM_OF_CPUs
Deployment Chain setup Auction deployment & simulation

Deployment script can do both deployment of the auction and can also run the simulation.

Deployment:

Simulation: The bidders are given some ether at the beggining. You can use --distribution-limit option to cap the amount distributed. Simulation will create n bidders that will send a random amount of ether in random intervals. If bidder runs out of funds, it will stop. If you set --claim-tokens option, bidders will also try to claim the tokens at the end of the simulation.

on -m deploy.deploy_testnet --chain privtest --owner 0x00a329c0648769a73afac7f9381e08fb43dbea72 simulation --bid-interval 3 --max-bid-ceiling 0.9 --max-bid-amount 10000000000 --min-bid-amount 100000000 --bidders 100 --claim-tokens

Both: To simplify things, you can just deploy & simulate:

on -m deploy.deploy_testnet --chain privtest --owner 0x00a329c0648769a73afac7f9381e08fb43dbea72  \
deploy --price-start 2000000 --price-constant 1574640000 --price-exponent 4
simulation --bid-interval 3 --max-bid-ceiling 0.9 --max-bid-amount 10000000000 --min-bid-amount 100000000 --bidders 100 --claim-tokens
Automatic token distribution

Deploys the Distributor contract used for claiming tokens for the bidders. Runs the script for retrieving bidder addresses from the DutchAuction contract events and batching them.

on -m distributor.main --chain privtest --auction ${AUCTION_ADDRESS} --auction-tx ${AUCTION_DEPLOY_TX_HASH}

Optional:

--distributor ${DISTRIBUTOR_ADDRESS} can be used to run the script with an already deployed Distributor contract. --batch-number can be used to set how many address we send to Distributor.distribute(), otherwise the number is calculated with estimateGas. --gas-price sets a custom gas price.

Solidity coding style

For solidity we generally follow the style guide as shown in the solidity documentation with a few notable exceptions:

Variable Names

All variable name should be in snake case, just like in python. Function names on the other hand should be mixedCase. MixedCase is essentially like CamelCase but with the initial letter being a small letter. This helps us to easily determine which function calls are smart contract calls in the python code side.

tion iDoSomething(uint awesome_argument) {
doSomethingElse();

Modifiers in long function declarations

This is how the solidity documentation suggests it:

tion thisFunctionNameIsReallyLong(
address x,
address y,
address z,

public
onlyowner
priced
returns (address)

doSomething();

This is the minor modification we make in order to make the code more readable when quickly skimming through it. The thinking here is to easily spot the start of the function's block when skimming and not have the modifiers appearing as if they are a block on their own due to the hanging parentheses.

tion thisFunctionNameIsReallyLong(
address x,
address y,
address z)

public
onlyowner
priced
returns (address)

doSomething();

Web App

Web prototype for testing auction models.

Installation
Prerequisites Setup
pp
or npm install
Usage
pp
or

This work is supported by the National Institutes of Health's National Center for Advancing Translational Sciences, Grant Number U24TR002306. This work is solely the responsibility of the creators and does not necessarily represent the official views of the National Institutes of Health.