forked from TokenMarketNet/smart-contracts
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathallocated-token-sale-example.yml
209 lines (183 loc) · 8.62 KB
/
allocated-token-sale-example.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
# This is an example for an allocated token sale example.
#
# Token supply is fixed and is created prior to sale. Then tokens are
# transfefred to sale participants by the token sale contract using
# EIP-20 approve() mechanism.
#
#
# To deploy this file
#
# deploy-contracts \
# --address=[my deploy account address account on geth having some Kovan ETH] \¨
# --deployment-file=crowdsales/allocated-token-sale-example.yml \
# --deployment-name=kovan
#
# This is the deployment-name parameter.
# We can have multiple deployments in a single YAML file.
kovan:
# This is the chain name in populus.json
# In the default configuration this Ethereum JSON-RPC in port 8547.
# Edit populus.json to change the port.
# You can run Parity as:
# parity \
# --chain=kovan \
# --unlock [My deploy account on Parity] \
# --jsonrpc-port 8547 \
# --password=password.txt
#
# password.txt must contain your Parity Kovan account unlock password
chain: kovan
# Use automated Chrome to verify all contracts on etherscan.io
verify_on_etherscan: yes
browser_driver: chrome
solc:
# This is the Solidity version tag we verify on EtherScan.
# For available versions see
# https://kovan.etherscan.io/verifyContract2
#
# See values in Compiler drop down.
# You can also get the local compiler version with:
#
# solc --version
#
# Note that for EtherScan you need to add letter "v" at the front of the version
#
# Note: You need to have correct optmization settings for the compiler
# in populus.json that matches what EtherScan is expecting.
#
version: v0.4.14+commit.c2215d46
#
# We supply these to EtherScan as the solc settings we used to compile the contract.
# They must match values in populus.json compilication / backends section.
#
optimizations:
optimizer: true
runs: 500
contracts:
# This is the address of the multisig wallet where the paymnts eventually land
team_multisig:
contract_name: MultiSigWallet
contract_file: GnosisWallet.sol
address: "0x40a05D4CE308BF600cb275d7a3e9113518f59C54"
#
# Token contract
#
# This contract represents ERC-20 token.
# It has transfer lock up functionality to prevent the token to be transferable
# until the ICO is over.
#
# We create the whole token supply upfront and no more token minting
# happens ever.
#
# Token has 18 decimals and supply of 1B tokens.
#
# Token supply is one billion tokens.
#
# Name and symbol are not set yet. They are set later. In
# the case of the deployment fails and we need redeploy
# we do not create unnecessary entries in token explorers.
#
token:
contract_name: BurnableCrowdsaleToken
contract_file: BurnableCrowdsaleToken.sol
arguments:
_name: ""
_symbol: ""
_initialSupply: "{{ 100000000000*10**18 }}"
_decimals: 18
_mintable: false
#
# Pricing strategy.
#
# We use ETH tranches. People who buy in in the first
# tranches get 20% and 10% bonus tokens.
#
pricing_strategy:
contract_name: EthTranchePricing
contract_file: EthTranchePricing.sol
arguments:
_tranches:
# This trance starts instantly.
# How many weis one token costs. 20% bonus tier.
# Price is base_price / 1.2
- 0
- 2272727272727
# This trance starts when we have sold 45k worth of tokens.
# Token price is 10% bonus tokens (base price / 1.1)
- "{{ to_wei('45000.00', 'ether') }}"
- 2380952380952
# This is the base price that is effective until the token
# sale ends.
- "{{ to_wei('90000.00', 'ether') }}"
- 2500000000000
# Dummy milestone marker to mark the end
# of the array.
- "{{ to_wei('999999999999999', 'ether') }}"
- 0
#
# Crowdsale.
#
# We use allocated crowdsale as the whole token supply has been created beforehand.
# No minting. Later we use approve() to give tokens for this contract to be sold.
#
crowdsale:
contract_name: AllocatedCrowdsale
contract_file: AllocatedCrowdsale.sol
arguments:
_token: "{{contracts.token.address}}"
_pricingStrategy: "{{contracts.pricing_strategy.address}}"
_multisigWallet: "{{contracts.team_multisig.address}}"
_start: "{{ timestamp(datetime(2099, 7, 12, 13, 00)) }}"
_end: "{{ timestamp(datetime(2099, 7, 26, 13, 00)) }}"
_minimumFundingGoal: "{{ to_wei(15000, 'ether') }}"
_beneficiary: "{{deploy_address}}"
#
# Because deploy_address controls whole supply,
# we do not create any supply dynamically,
# we do not need a finalizer.
#
finalize_agent:
contract_name: NullFinalizeAgent
contract_file: NullFinalizeAgent.sol
arguments:
_crowdsale: "{{contracts.crowdsale.address}}"
# Post-deployment actions connect contracts together.
post_actions: |
# Allow crowdsale contract to sell its token
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.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.functions.setFinalizeAgent(finalize_agent.address).transact({"from": deploy_address}))
# Owner can release the token transfer when they fel its the time
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.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.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.functions.setPreicoAddress("0x6d997eDcA04282950416FA380d834f360fC36eBb", 2083333333333).transact({"from": deploy_address}))
# Sanity check
verify_actions: |
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.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.functions.setTokenInformation("MooToken", "MOO").transact({"from": deploy_address}))