Skip to content

Commit

Permalink
Merge pull request #139 from voith/web3-4.x-solidity-latest
Browse files Browse the repository at this point in the history
Web3 4.x and  solidity > 0.4.20 support
  • Loading branch information
villesundell committed Nov 23, 2018
2 parents 2772b87 + ed4b336 commit 60872f9
Show file tree
Hide file tree
Showing 74 changed files with 1,777 additions and 1,614 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -93,3 +93,6 @@ csvs

# Created by pytest
.pytest_cache

# pycharm
.idea/
6 changes: 2 additions & 4 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
language: python
python: 3.5
python: 3.6
dist: trusty
sudo: true

env:
- TOXENV=py35 SOLC_VERSION=0.4.18
- TOXENV=py36 SOLC_VERSION=0.4.24

cache:
- pip: true
Expand All @@ -16,8 +16,6 @@ before_install:
- if [ -n "$SOLC_VERSION" ]; then export SOLC_BINARY="$TRAVIS_BUILD_DIR/solc-versions/solc-$SOLC_VERSION/solc"; fi
- if [ -n "$SOLC_VERSION" ]; then export LD_LIBRARY_PATH="$TRAVIS_BUILD_DIR/solc-versions/solc-$SOLC_VERSION"; fi
- if [ -n "$SOLC_VERSION" ]; then sudo apt-get install -y tree unzip; fi
- sudo add-apt-repository -y ppa:ethereum/ethereum
- sudo apt-get update

install:
- if [ ! -e "$SOLC_BINARY" ]; then /.$TRAVIS_BUILD_DIR/install_solc.sh; fi
Expand Down
20 changes: 16 additions & 4 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ TokenMarket 2018 conference, Gibraltar, June 28th - 29th

Our conference TokenMarket 2018: Insights into the Token Economy is held June 28th in Gibraltar. Tokenisation has created new financial markets. Join the industry leaders to discuss where those markets are heading.

`View conference and buy the tickets now <https://tokenmarket.net/conference-2018>`_
`View conference and buy the tickets now <https://tokenmarket.net/conference-2018>`_

About
=====
Expand Down Expand Up @@ -82,7 +82,7 @@ Features and design goals

* **KYC**: Know your customer processes are support enabled to minimize legal risks associated with anonymous payments - `see KYCCrowdsale <https://github.com/TokenMarketNet/ico/blob/master/contracts/KYCCrowdsale.sol>`_

* **AML**: Anti-money laundering processes are supported through offloaded chain analysis - often a requirement to open a bank account - `see AMLToken <https://github.com/TokenMarketNet/ico/blob/master/contracts/AMLToken.sol>`_
* **AML**: Anti-money laundering processes are supported through offloaded chain analysis - often a requirement to open a bank account - `see AMLToken <https://github.com/TokenMarketNet/ico/blob/master/contracts/AMLToken.sol>`_

* **Separation of concerns**: Crowdsale, token and other logic lies in separate contracts that can be assembled together like lego bricks

Expand All @@ -109,16 +109,28 @@ TokenMarket can be a launch and hosting partner for your token sale. We offer ad

Community support is available on the best effort basis - your mileage may vary. To get the most of the community support we expect you to be on a senior level of Solidity, Python and open source development. `Meet us at the Gitter support chat <https://gitter.im/TokenMarketNet/ico>`_.


Running tests locally
=====================

Quick tutorial (see docs for more information)::

export SOLC_BINARY=$(pwd)/dockerized-solc.sh
export SOLC_VERSION=0.4.24
tox



Audit reports
=============

Some public audit reports available for some revisions of this codebase:

* `For Atonomi by LevelK, May 2018 <https://drive.google.com/file/d/0B6r9uCgN_xpJeUdRaGxaQ3VrTVBiekg5V25aUEUycDVZWlhn/view?usp=sharing>`_

* `For Dala by Iosiro, October 2017 <https://www.iosiro.com/dala-token-sale-audit>`_
* `For Dala by Iosiro, October 2017 <https://www.iosiro.com/dala-token-sale-audit>`_

* `For Civic by Zeppelin, June 2017 <https://medium.com/@ZeppelinOrg/a91754ab6e4b>`_
* `For Civic by Zeppelin, June 2017 <https://medium.com/@ZeppelinOrg/a91754ab6e4b>`_

More audit reports available on a request.

42 changes: 21 additions & 21 deletions crowdsales/allocated-token-sale-acceptance-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
# Please note that some numbers are slightly changed.
#

testrpc:
tester:

chain: testrpc
chain: tester

# Use automated Chrome to verify all contracts on etherscan.io
verify_on_etherscan: no
Expand Down Expand Up @@ -42,7 +42,7 @@ testrpc:
team_multisig:
contract_name: MultiSigWallet
contract_file: GnosisWallet.sol
address: "0x40a05d4ce308bf600cb275d7a3e9113518f59c54"
address: "0x40a05D4CE308BF600cb275d7a3e9113518f59C54"
#
# Token contract
#
Expand Down Expand Up @@ -132,50 +132,50 @@ testrpc:
post_actions: |
# Allow crowdsale contract to sell its token
token.transact({"from": deploy_address}).approve(crowdsale.address, 70000000*(10**18))
token.functions.approve(crowdsale.address, 70000000*(10**18)).transact({"from": deploy_address})
# Make sure crowdsale contract and these accounts
# can transfer tokens despite transfer lock up
token.transact({"from": deploy_address}).setTransferAgent(team_multisig.address, True)
token.transact({"from": deploy_address}).setTransferAgent(crowdsale.address, True)
token.transact({"from": deploy_address}).setTransferAgent(finalize_agent.address, True)
token.transact({"from": deploy_address}).setTransferAgent(deploy_address, True)
token.functions.setTransferAgent(team_multisig.address, True).transact({"from": deploy_address})
token.functions.setTransferAgent(crowdsale.address, True).transact({"from": deploy_address})
token.functions.setTransferAgent(finalize_agent.address, True).transact({"from": deploy_address})
token.functions.setTransferAgent(deploy_address, True).transact({"from": deploy_address})
# Do not do nothing at the end of the crowdsale
confirm_tx(crowdsale.transact({"from": deploy_address}).setFinalizeAgent(finalize_agent.address))
confirm_tx(crowdsale.functions.setFinalizeAgent(finalize_agent.address).transact({"from": deploy_address}))
# Owner can release the token transfer when they fel its the time
confirm_tx(token.transact({"from": deploy_address}).setReleaseAgent(deploy_address))
confirm_tx(token.functions.setReleaseAgent(deploy_address).transact({"from": deploy_address}))
# Set token upgrade master to team multisig to give the new token path
confirm_tx(token.transact({"from": deploy_address}).setUpgradeMaster(team_multisig.address))
confirm_tx(token.functions.setUpgradeMaster(team_multisig.address).transact({"from": deploy_address}))
# Allow test buys from these accounts before token sale begins.
# The latter one is a presale contract address.
# Presale contract (PreICOProxyBuyer) can move in funds
# and get tokens before the actual start time.
confirm_multiple_txs( \
crowdsale.transact({"from": deploy_address}).setEarlyParicipantWhitelist(deploy_address, True), \
crowdsale.transact({"from": deploy_address}).setEarlyParicipantWhitelist("0x6d997eDcA04282950416FA380d834f360fC36eBb", True) \
crowdsale.functions.setEarlyParicipantWhitelist(deploy_address, True).transact({"from": deploy_address}), \
crowdsale.functions.setEarlyParicipantWhitelist("0x6d997eDcA04282950416FA380d834f360fC36eBb", True).transact({"from": deploy_address}) \
)
# We set a special price, outside ETH tranches, for a presale contract
confirm_tx(pricing_strategy.transact({"from": deploy_address}).setPreicoAddress("0x6d997eDcA04282950416FA380d834f360fC36eBb", 2083333333333))
# Sanity check
verify_actions: |
assert token.call().owner().lower() == deploy_address.lower()
assert token.call().released() == False
assert crowdsale.call().owner().lower() == deploy_address.lower()
assert crowdsale.call().multisigWallet().lower() == team_multisig.address.lower()
assert finalize_agent.call().isSane()
assert crowdsale.call().getState() == CrowdsaleState.PreFunding # PreFunding for the final, as it is deployed pre-opening
assert token.functions.owner().call() == deploy_address
assert token.functions.released().call() == False
assert crowdsale.functions.owner().call() == deploy_address
assert crowdsale.functions.multisigWallet().call() == team_multisig.address
assert finalize_agent.functions.isSane().call()
assert crowdsale.functions.getState().call() == CrowdsaleState.PreFunding # PreFunding for the final, as it is deployed pre-opening
# Do a test buy using a test address.
# This ensures are variables are set and the
# funds flow in the multisig wallet.
confirm_tx(crowdsale.transact({"from": deploy_address, "value": to_wei("0.01", "ether")}).buy())
confirm_tx(crowdsale.functions.buy().transact({"from": deploy_address, "value": to_wei("0.01", "ether")}))
# As the last action, after successful deployment, set the right token symbol and name so that it shows in a blockchain explorer
confirm_tx(token.transact({"from": deploy_address}).setTokenInformation("MooToken", "MOO"))
confirm_tx(token.functions.setTokenInformation("MooToken", "MOO").transact({"from": deploy_address}))
40 changes: 20 additions & 20 deletions crowdsales/allocated-token-sale-example.yml
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ kovan:
team_multisig:
contract_name: MultiSigWallet
contract_file: GnosisWallet.sol
address: "0x40a05d4ce308bf600cb275d7a3e9113518f59c54"
address: "0x40a05D4CE308BF600cb275d7a3e9113518f59C54"
#
# Token contract
#
Expand Down Expand Up @@ -160,50 +160,50 @@ kovan:
post_actions: |
# Allow crowdsale contract to sell its token
token.transact({"from": deploy_address}).approve(crowdsale.address, 70000000000*10**18)
token.functions.approve(crowdsale.address, 70000000000*10**18).transact({"from": deploy_address})
# Make sure crowdsale contract and these accounts
# can transfer tokens despite transfer lock up
token.transact({"from": deploy_address}).setTransferAgent(team_multisig.address, True)
token.transact({"from": deploy_address}).setTransferAgent(crowdsale.address, True)
token.transact({"from": deploy_address}).setTransferAgent(finalize_agent.address, True)
token.transact({"from": deploy_address}).setTransferAgent(deploy_address, True)
token.functions.setTransferAgent(team_multisig.address, True).transact({"from": deploy_address})
token.functions.setTransferAgent(crowdsale.address, True).transact({"from": deploy_address})
token.functions.setTransferAgent(finalize_agent.address, True).transact({"from": deploy_address})
token.functions.setTransferAgent(deploy_address, True).transact({"from": deploy_address})
# Do not do nothing at the end of the crowdsale
confirm_tx(crowdsale.transact({"from": deploy_address}).setFinalizeAgent(finalize_agent.address))
confirm_tx(crowdsale.functions.setFinalizeAgent(finalize_agent.address).transact({"from": deploy_address}))
# Owner can release the token transfer when they fel its the time
confirm_tx(token.transact({"from": deploy_address}).setReleaseAgent(deploy_address))
confirm_tx(token.functions.setReleaseAgent(deploy_address).transact({"from": deploy_address}))
# Set token upgrade master to team multisig to give the new token path
confirm_tx(token.transact({"from": deploy_address}).setUpgradeMaster(team_multisig.address))
confirm_tx(token.functions.setUpgradeMaster(team_multisig.address).transact({"from": deploy_address}))
# Allow test buys from these accounts before token sale begins.
# The latter one is a presale contract address.
# Presale contract (PreICOProxyBuyer) can move in funds
# and get tokens before the actual start time.
confirm_multiple_txs( \
crowdsale.transact({"from": deploy_address}).setEarlyParicipantWhitelist(deploy_address, True), \
crowdsale.transact({"from": deploy_address}).setEarlyParicipantWhitelist("0x6d997eDcA04282950416FA380d834f360fC36eBb", True) \
crowdsale.functions.setEarlyParicipantWhitelist(deploy_address, True).transact({"from": deploy_address}), \
crowdsale.functions.setEarlyParicipantWhitelist("0x6d997eDcA04282950416FA380d834f360fC36eBb", True).transact({"from": deploy_address}) \
)
# We set a special price, outside ETH tranches, for a presale contract
confirm_tx(pricing_strategy.transact({"from": deploy_address}).setPreicoAddress("0x6d997eDcA04282950416FA380d834f360fC36eBb", 2083333333333))
confirm_tx(pricing_strategy.functions.setPreicoAddress("0x6d997eDcA04282950416FA380d834f360fC36eBb", 2083333333333).transact({"from": deploy_address}))
# Sanity check
verify_actions: |
assert token.call().owner().lower() == deploy_address.lower()
assert token.call().released() == False
assert crowdsale.call().owner().lower() == deploy_address.lower()
assert crowdsale.call().multisigWallet().lower() == team_multisig.address.lower()
assert finalize_agent.call().isSane()
assert crowdsale.call().getState() == CrowdsaleState.PreFunding # PreFunding for the final, as it is deployed pre-opening
assert token.functions.owner().call() == deploy_address
assert token.functions.released().call() == False
assert crowdsale.functions.owner().call() == deploy_address
assert crowdsale.functions.multisigWallet().call() == team_multisig.address
assert finalize_agent.functions.isSane().call()
assert crowdsale.functions.getState() .call()== CrowdsaleState.PreFunding # PreFunding for the final, as it is deployed pre-opening
# Do a test buy using a test address.
# This ensures are variables are set and the
# funds flow in the multisig wallet.
confirm_tx(crowdsale.transact({"from": deploy_address, "value": to_wei("0.01", "ether")}).buy())
confirm_tx(crowdsale.functions.buy().transact({"from": deploy_address, "value": to_wei("0.01", "ether")}))
# As the last action, after successful deployment, set the right token symbol and name so that it shows in a blockchain explorer
confirm_tx(token.transact({"from": deploy_address}).setTokenInformation("MooToken", "MOO"))
confirm_tx(token.functions.setTokenInformation("MooToken", "MOO").transact({"from": deploy_address}))
8 changes: 4 additions & 4 deletions crowdsales/crowdsale-token-example-ganache.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,19 +55,19 @@ local-token:
# In post-actions we make token transferable.
# Make owner to be address / contract that controls the release
confirm_tx(token.transact({"from": deploy_address}).setReleaseAgent(deploy_address))
confirm_tx(token.functions.setReleaseAgent(deploy_address).transact({"from": deploy_address}))
# Unlock token transfers
confirm_tx(token.transact({"from": deploy_address}).releaseTokenTransfer())
confirm_tx(token.functions.releaseTokenTransfer().transact({"from": deploy_address}))
# Verify that we have correctly deployed the contract
verify_actions: |
# Token is now transferable
assert token.call().released()
assert token.functions.released().call()
# We deployed using coinbase account
assert deploy_address == web3.eth.accounts[0]
# Check that the owner got all initial balance
assert token.call().balanceOf(deploy_address) == 100000000000*10**18
assert token.functions.balanceOf(deploy_address).call() == 100000000000*10**18
8 changes: 4 additions & 4 deletions crowdsales/crowdsale-token-example.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,20 +55,20 @@ local-token:
# In post-actions we make token transferable.
# Make owner to be address / contract that controls the release
confirm_tx(token.transact({"from": deploy_address}).setReleaseAgent(deploy_address))
confirm_tx(token.functions.setReleaseAgent(deploy_address).transact({"from": deploy_address}))
# Unlock token transfers
confirm_tx(token.transact({"from": deploy_address}).releaseTokenTransfer())
confirm_tx(token.functions.releaseTokenTransfer().transact({"from": deploy_address}))
# Verify that we have correctly deployed the contract
verify_actions: |
# Token is now transferable
assert token.call().released()
assert token.functions.released().call()
# We deployed using coinbase account
assert deploy_address == web3.eth.accounts[0]
# Check that the owner got all initial balance
assert token.call().balanceOf(deploy_address) == 100000000000*10**18
assert token.functions.balanceOf(deploy_address).call() == 100000000000*10**18
24 changes: 12 additions & 12 deletions crowdsales/example.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ testnet:
team_multisig:
contract_name: MultiSigWallet
contract_file: GnosisWallet.sol
address: "0x40a05d4ce308bf600cb275d7a3e9113518f59c54"
address: "0x40a05D4CE308BF600cb275d7a3e9113518f59C54"
#
# Pre-ICO fund collector
#
Expand Down Expand Up @@ -171,23 +171,23 @@ testnet:
# They set ownership and allowed actions, so that contracts can interact
post_actions: |
# Enable new token minting by a crowdsale contract
token.transact({"from": deploy_address}).setMintAgent(crowdsale.address, True)
token.functions.setMintAgent(crowdsale.address, True).transact({"from": deploy_address})
# Set actions what happen at the end of the crodsale.
# Enable token mintint at the end of the crowdsale to create bonus pool, founder pool and such
token.transact({"from": deploy_address}).setMintAgent(finalize_agent.address, True)
crowdsale.transact({"from": deploy_address}).setFinalizeAgent(finalize_agent.address)
token.transact({"from": deploy_address}).setReleaseAgent(finalize_agent.address)
token.functions.setMintAgent(finalize_agent.address, True).transact({"from": deploy_address})
crowdsale.functions.setFinalizeAgent(finalize_agent.address).transact({"from": deploy_address})
token.functions.setReleaseAgent(finalize_agent.address).transact({"from": deploy_address})
# Set the team multisig address as the upgraade master for the token
token.transact({"from": deploy_address}).transferOwnership(team_multisig.address)
token.functions.transferOwnership(team_multisig.address).transact({"from": deploy_address})
# Make sure that everything we have deployed all contracts in good state
# and their internal state is sane
verify_actions: |
assert token.call().owner() == team_multisig.address
assert crowdsale.call().owner() == team_multisig.address
assert preico.call().owner() == team_multisig.address
assert finalize_agent.call().teamMultisig() == team_multisig.address
assert finalize_agent.call().isSane()
assert crowdsale.call().getState() == CrowdsaleState.PreFunding
assert token.functions.owner().call() == team_multisig.address
assert crowdsale.functions.owner().call() == team_multisig.address
assert preico.functions.owner().call() == team_multisig.address
assert finalize_agent.functions.teamMultisig().call() == team_multisig.address
assert finalize_agentfunctions.isSane().call()
assert crowdsale.functions.getState().call() == CrowdsaleState.PreFunding

0 comments on commit 60872f9

Please sign in to comment.